Skip to main content

πŸ“ AWS EC2 Instance is idle 🟒

  • Contextual name: πŸ“ Instance is idle 🟒
  • ID: /ce/ca/aws/ec2/instance-idle
  • Located in: πŸ“ AWS EC2

Flags​

Our Metadata​

  • Policy Type: COMPLIANCE_POLICY
  • Policy Category:
    • PERFORMANCE
    • COST

Logic​

Description​

Open File

Description​

Identify Amazon EC2 instances with minimal activity over the past 14 days and address them to reduce unnecessary costs. Instances are classified as idle if they meet all the following criteria:

  • Average CPU utilization below 5%
  • Maximum CPU utilization below 15%
  • Average network I/O less than 100 MB

Rational​

Idle EC2 instances consume resources and incur costs without contributing meaningfully to operations. Adding maximum CPU utilization as a criterion ensures instances experiencing brief spikes in usage are not prematurely identified as idle. This approach improves accuracy in cost-saving measures while maintaining operational efficiency. Addressing idle instances reduces waste and optimizes the AWS environment.

Audit​

This policy evaluates an EC2 instance based on its 14-day performance metrics.

The instance is marked as INCOMPLIANT if all the following criteria are met:

  • CPU Utilization, Average, % field is less than 5%.
  • CPU Utilization, Max, % field is less than 15%.
  • Network In, Sum, Megabytes field is less than 100 MB.

... see more

Remediation​

Open File

Remediation​

IMPORTANT: Before taking any action, ensure critical data and configurations are backed up. Carefully evaluate idle instances to avoid disrupting essential workloads or losing valuable resources.

From Command Line​

Stop Idle Instances​
Prerequisites​
  • Verify that the root device of the instance is an EBS volume. You can't stop instances with instance store root device.

  • Warning: When you stop an instance, the data on any instance store volumes is erased. Before you stop an instance, verify that you've copied any data that you need from the instance store volumes to persistent storage, such as Amazon EBS or Amazon S3.

Stop idle instances to retain their configurations for potential future use:

aws ec2 stop-instances --instance-ids {{instance-id}}

If applicable, initiate hibernation using the --hibernate flag for On-Demand or Spot Instances. Hibernation is supported only for EBS-backed instances that are enabled for hibernation and meet the prerequisites. Hibernation saves the contents of the RAM to the Amazon EBS root volume.

... see more

policy.yaml​

Open File

Linked Framework Sections​

SectionSub SectionsInternal RulesPoliciesFlags
πŸ’Ό Cloudaware Framework β†’ πŸ’Ό Waste Reduction1
πŸ’Ό Cloudaware Framework β†’ πŸ’Ό Workload Efficiency3