Week 5-6: Cloud Automation, Cost Optimization, and Serverless Ops with AWS Lambda & Boto3
DevOps & Cloud learner, currently in the deep end with Linux, Git, and AWS. BTech CSE student breaking things on purpose (and learning how to fix them). Exploring real infrastructure, automation, and the tools that keep modern systems running.
What actually went down this week
Weeks 5 and 6 focused heavily on cloud foundations, automation, monitoring, and cost optimization — connecting learned concepts into practical scripts and serverless automation.
I built multiple real-world AWS automation projects including:
Automating AWS resource provisioning with Python Boto3: EC2 launch, Apache setup, S3 bucket/file management, IAM policy attachments, and CloudWatch alarms.
Hands-on AWS Lambda function implementing cleanup of stale EBS snapshots to reduce storage costs. Scheduled with EventBridge cron.
Setup IAM least privilege roles for Lambda and EC2 automation scripts for security best practices.
Detailed log monitoring and troubleshooting using CloudWatch Logs for Lambda executions and EC2 monitoring alarms.
Why I had to tackle these topics now
Moving beyond manual AWS Console interaction towards scalable automation is critical for real DevOps/Cloud proficiency:
Automating provisioning makes infrastructure repeatable and error-resistant.
Lambda-based cleanup helps control AWS costs proactively.
IAM best practices reduce security risks in automation workflows.
CloudWatch monitoring enables real-time and historical insight on resource health.
The topics I finished (short notes + useful commands)
AWS Automation with Boto3
Scripts to launch EC2, install Apache, create S3 buckets, and setup CloudWatch alarms programmatically:
python scripts/automation.py
Key AWS CLI commands monitored/logged within scripts.
AWS Lambda Snapshot Cleaner
Python code automates deletion of snapshots orphaned from volumes or instances:
# Fetch snapshots and instances, delete stale snapshots
def lambda_handler(event, context):
Scheduled using EventBridge cron for weekly run.
IAM Role & Policy Management
Configured AWS IAM roles with well-scoped policies for Lambda and EC2 automation.
CloudWatch Monitoring & Logs
Used CloudWatch Logs to monitor Lambda runs and EC2 CPU alarms.
The things that broke (and how I fixed them)
Lambda permission errors → Enhanced IAM execution role
Snapshot volume missing edge cases → Added exception handling
Timeout in Lambda for large snapshot sets → Increased timeout setting
Cron environment quirks → Added absolute paths and logging in scripts
What I learned the hard way
Infrastructure as code is key to reliable cloud ops.
Lambda automation can reduce AWS costs dramatically.
Least-privilege IAM roles critical for security.
Logs and alarms are vital troubleshooting tools.
Scheduling with EventBridge ensures continuous automation.
Resources I actually used
Up Next: Week 7 Plan
Deep dive into AWS networking: VPCs, subnets, route tables, and gateways
Build public-private subnet architectures with bastion hosts for secure access - Create layered security using Security Groups and Network ACLs (NACLs)
Explore Terraform basics: install, configure AWS CLI, deploy networking and EC2
Automate IAM user/role management with Boto3 and configure AWS Budgets for cost control
Launch scalable EC2 instances using Terraform and EC2 Launch Templates with IAM roles attached
Follow along
GitHub: shauryad01/cloud-devops-journey
LinkedIn: Shaurya Dhingra