Inspiration The inspiration for this project came from a common issue faced by cloud users—forgetting to shut down virtual environments, leading to unexpected costs and resource wastage. Whether in development or testing, cloud environments can often be left running longer than intended. We wanted to automate the shutdown process, offering peace of mind and financial efficiency for users who manage AWS resources.
What We Learned This project deepened our understanding of cloud automation using Terraform and AWS services. We learned about the configuration and deployment of AWS resources, Lambda functions, and CloudWatch Event Rules to automate tasks. We also gained hands-on experience in infrastructure-as-code (IaC) principles, reinforcing the power of automation for managing resources in the cloud.
How We Built the Project Using Terraform, we provisioned an AWS EC2 instance and an S3 bucket to hold the Lambda function code. The core of the solution was a Lambda function triggered by a CloudWatch Event Rule. This rule scheduled the function to run after a specified period, instructing the Lambda to shut down the instance automatically. Key components included:
Terraform for defining and deploying AWS resources, Lambda for executing the shutdown, CloudWatch for triggering the function at the specified interval, and S3 for storing and accessing the Lambda code. Challenges We Faced Setting up seamless communication between AWS services presented challenges, especially configuring IAM roles for Lambda to securely control the EC2 instance. Debugging Terraform configurations, particularly when managing resource dependencies, required careful attention. Additionally, handling deprecation warnings and resource limitations in Terraform made for a few learning curves along the way.
Built With
- amazon-web-services
- javascript
- terraform
Log in or sign up for Devpost to join the conversation.