Stop idle EC2 instances
AWS Resource Type:
Over time, it is common for an AWS account to accumulate a number of idle EC2 instances as a result of product re-architectures, migration of workloads, or instances being spawned for temporary use such as PoCs. Most idle EC2 instances can be stopped. Stopped instances do not incur charges (apart from attached EBS volumes and Elastic IP addresses) and are easy to restart.
Criteria for identifying the opportunity:
Instances must have a Maximum CPU CloudWatch metric less than 1% for the previous 31 days to be considered.
The following are excluded:
- ASG instances
- Instances that support ephemeral storage
- Instances with termination protection enabled
Potential savings (range in % on annual basis):
Across the CloudFix user base, we have found that roughly 3% of EC2 instances are idle. This corresponds to roughly 1% of EC2 spending.
What happens when the Fixer is executed?
The fixer creates a launch template that can be used in case a rollback is required. It uses the 'TagSpecification' parameter to tag the launch template:
- Key: InstanceId. Value: EC2 instance id.
- Key: cf-fixer-execution-id. Value: id of this Fixer.
The fixer saves the template content along with the generated ID to the CloudFix S3 bucket named `cloudfix-fixer-executions<AccountId>`, with a key of `Ec2CleanUpIdleInstances/<TemplateId>`, where `AccountId` is the AWS Account Id, and `TemplateId` is the Lauch Template ID. It then uses the StopInstances API to stop the instance.
Is it possible to rollback once CloudFix implements the fixer?
Yes. The customer can initiate a rollback which will restart the instance if it is stopped, or use the launch template in case that was created (if the instance was terminated).
Parameter: InstanceId: id of the instance to rollback.
Can CloudFix implement the fix automatically once I accept the recommendation?
Does this fix require downtime?
Article is closed for comments.