Description: 

Elastic Compute Cloud (EC2) provides scalable computing capacity in the Amazon Web Services (AWS) Cloud. Amazon EC2 enables you to scale up or down to handle changes in requirements or spikes in popularity, reducing your need to forecast traffic. You can use Amazon EC2 to launch as many or as few virtual servers as you need, configure security and networking, and manage storage.


Rationale:  

 An EC2 instance is not supposed to run indefinitely in the cloud and having too old instances within your AWS account could increase the risk of potential issues.


Impact:

When restarted the instance retains its private IPv4 addresses and any IPv6 addresses when stopped and started. We release the public IPv4 address and assign a new one when you start it.


Default value:

By default, AWS will never restart the EC2 instances.

 

Audit:  

  1. Sign in to the AWS Management Console.

  2. Navigate to EC2 dashboard at https://console.aws.amazon.com/ec2/.

  3. Under INSTANCES section, choose Instances, in the left navigation panel

  4. Select the EC2 instance that you want to examine.Select the Details tab from the dashboard bottom panel.

  5. In the right column, check the Launch time

    If the selected EC2 instance active age is greater than 6 months, the instance is considered old and requires a restart. To do that follow the implementation steps.


Remediation:

Pre-Requisite:

  1. Sign in as admin or IAM user with required permissions

  2. Selected Instance state should be in running

Implementation steps:

  1. Sign in to the AWS Management Console.

  2. Navigate to EC2 dashboard at https://console.aws.amazon.com/ec2/.

  3. Under INSTANCES section, choose Instances, in the left navigation panel

  4. Select the EC2 instance that you want to restart

  5. Click on the Instance State dropdown button in the top menu and click Stop Instance.
    The instance status will change from running to stopping to stopped.
    Note: This step will incur downtime for the application(s) running on the selected instance.

  6. Click again on the Instance State dropdown button in the top menu and click start Instance.
    The instance status will change from stopped to pending to
    running.


Via CLI:

To stop Instance

aws ec2 stop-instances
  --region us-east-1
  --instance-ids i-0c41af2ddee0308d6


To start Instance

aws ec2 start-instances
  --region us-east-1
  --instance-ids i-0c41af2ddee0308d6


Reference:

https://aws.amazon.com/ec2/?ec2-whats-new.sort-by=item.additionalFields.postDateTime&ec2-whats-new.sort-order=desc