'how to stop our instance if idle for 30 min in aws cloud watch
I have setup aws cloud watch
Here is below detail set in our cloud watch
- Metric name: CPUUtilization
- Statistic: average
- Period: 5 min
- Threshold Type: Static
- Whenever CPUUtilization is Lower/Equal then 10
- Datapoints to alarm: 1 out of 1
- Missing data treatment: Treat missing data as missing
EC2 action:
- Alarm state trigger: In Alarm
- Take the following action: stop this instance
After 5 min our server still does not stop with the cloud watch in aws.
Solution 1:[1]
You can use CloudWatch Events to trigger a Lambda that will perform the stop instance call on the ec2 instance.
Solution 2:[2]
At Feb 2022 you have these options:
- You can use Alarms to automate shutdown and terminate instances:
- You can view idle instances in CUR recommendations : https://aws.amazon.com/about-aws/whats-new/2013/01/08/use-amazon-cloudwatch-to-detect-and-shut-down-unused-amazon-ec2-instances/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Raul Barreto |
| Solution 2 | Impermanence |

