Amazon_EC2_29

Ensure there should not be any Idle EC2 Instance

Description

Stop or terminate EC2 instances that appear to be idle to lower the cost of your monthly AWS bill. By default, an EC2 instance is considered ‘idle’ when both of the following criteria meet :

  • The average CPU Utilization has been less than 2% for the last 7 days.
  • The average Network I/O has been less than 5 MB for the last 7 days.

Remediation

1. Sign in to the AWS Management Console.

2. Navigate to EC2 dashboard.

3. In the left navigation panel, under INSTANCES section, choose Instances.

4. Select the idle EC2 instance that you want to stop or terminate.

5. Based on the instance attachment to an AWS Auto Scaling Group (ASG), choose one of the following sets of instructions:

  1. To stop/terminate an EC2 instance that is not running within an AWS ASG, click the Actions dropdown button from the dashboard top menu, select Instance State and choose one of the following options:
    • To stop the instance click Stop. In the Stop Instances dialog box, review the instance details then click Yes, Stop to confirm your action. The resource status should change to stopping and then to stopped as the shutdown process progress.
    • To terminate the instance click Terminate. In the Terminate Instances dialog box, review the instance details then click Yes, Terminate to confirm your action. The resource status should change to shutting-down and then to terminated as the removal process progress.
  2. To stop/terminate an EC2 instance that is currently running within an AWS ASG perform the following:
    • If In the navigation panel, under AUTO SCALING, choose Auto Scaling Groups.
    • Select the ASG that holds the idle EC2 instance that you want to stop/terminate.
    • Choose the Instances tab from the dashboard bottom panel and select the right instance.
    • Click on the Actions dropdown button available on the panel then select Detach.
    • In the Detach Instance dialog box, uncheck Add a new instance to the Auto Scaling group to balance the load to decrement the ASG desired capacity then click Detach Instance to confirm the action.
    • Once the idle instance is detached from your ASG you will be able to stop or terminate it without triggering a Scale In event for replacing the instance. Now that the EC2 instance is no longer running within an AWS ASG, follow the above instructions stop/terminate the resource.

Service

EC2

Severity

High

Compliance

Mapping

We are now live on AWS Marketplace.
The integrated view of your cloud infrastructure is now easier than ever!