This code stops running instances at 5pm and starts them at 9am every weekday (Mon - Fri). Lambda runs the actual python functions that start and stop instances, while Eventbridge sets a schedule and triggers the Lambda functions at specified times. With automation and strategies as this, you can effectively reduce AWS expenditure without compromise on performance or functionality.
- An AWS account
- Terraform installed on your local system
- One or more running AWS instances
- Clone this repo
- Enter root directory:
cd stop_start_instances
- Enter AWS instances' IDs in .py files
- Edit the cron expressions in eventbridge.tf to specify your time schedules
terraform init
terraform plan
terraform apply
terraform destroy