Triage and Remediation
Remediation
Using Console
Using Console
When you receive a notification that your AWS Reserved Instances are expiring in the next 30 days, you need to take action to prevent any disruptions to your AWS resources. Here are the steps to remediate this issue using the AWS console:
- Log in to your AWS Management Console.
- Navigate to the EC2 dashboard.
- Click on the “Reserved Instances” link in the left-hand navigation menu.
- In the “Reserved Instances” page, you will see a list of all your reserved instances. Look for the ones that are expiring in the next 30 days.
- Select the reserved instances that are expiring soon and click on the “Actions” button.
- From the drop-down menu, select “Modify Reserved Instances”.
- In the “Modify Reserved Instances” page, you can modify the instance type, availability zone, and the number of instances you want to reserve.
- Once you have made the necessary changes, click on the “Modify” button to save the changes.
- After modifying the reserved instances, you will receive a confirmation message that the changes have been made.
Using CLI
Using CLI
The “Reserved Instance Lease Expiration In The Next 30 Days” issue in AWS means that some of your Reserved Instances are about to expire. To remediate this issue, you can follow the below steps using AWS CLI:This command will list all the active Reserved Instances that are running Linux/UNIX in Amazon VPC and are scoped to Availability Zone, and whose lease is expiring in the next 30 days.Replace [COUNT] with the number of instances you want to reserve, [OFFERING_ID] with the ID of the offering that matches the expiring Reserved Instance, and —dry-run with —no-dry-run to actually purchase the Reserved Instance.Replace [OLD_INSTANCE_ID] with the ID of the expiring Reserved Instance and [NEW_INSTANCE_ID] with the ID of the newly purchased Reserved Instance.Replace [OLD_INSTANCE_ID] with the ID of the expiring Reserved Instance.By following the above steps, you can remediate the “Reserved Instance Lease Expiration In The Next 30 Days” issue in AWS using AWS CLI.
- Open your terminal and ensure that you have the AWS CLI installed and configured with your AWS account credentials.
- Run the following command to list all the Reserved Instances that are about to expire in the next 30 days:
- Review the output and identify the Reserved Instances that you want to renew. Note down the Reserved Instance ID(s) that you want to renew.
- Run the following command to purchase a new Reserved Instance with the same specifications and lease term as the expiring Reserved Instance:
- Verify that the new Reserved Instance is active and that the old Reserved Instance has been retired by running the following command:
- Once you have verified that the new Reserved Instance is active, you can terminate the old Reserved Instance by running the following command:
Using Python
Using Python
To remediate the issue of Reserved Instance Lease Expiration In The Next 30 Days in AWS using Python, you can follow these steps:
- Import the required libraries:
- Create a connection to the AWS EC2 service:
- Retrieve the list of Reserved Instances with lease expiration dates within the next 30 days:
- For each Reserved Instance, check if its lease expiration date is within the next 30 days and if so, modify its lease to extend it:
- Run the Python script on a regular basis (e.g. daily) using a scheduler like cron to ensure that Reserved Instances are always extended before their lease expires.