Reputation: 11
I have setup aws cloud watch
Here is below detail set in our cloud watch
EC2 action:
After 5 min our server still does not stop with the cloud watch in aws.
Upvotes: 1
Views: 1138
Reputation: 3460
You can create an SQS queue whose target is a Python Lambda function. The python lambda function can use boto to turn off the ec2 instance.
Then you can set this SQS as an alarm action for your Cloudwatch Alarm. You can find more details here:
https://medium.com/geekculture/automatically-turn-off-ec2-instances-upon-inactivity-31fedd363cad
Terraform setup:
Upvotes: 1
Reputation: 184
At Feb 2022 you have these options:
Upvotes: 2
Reputation: 1124
You can use CloudWatch Events to trigger a Lambda that will perform the stop instance call on the ec2 instance.
Upvotes: 0