Skip to main content

Triage and Remediation

  • Remediation

Remediation

Using Console

To renew RDS Reserved Instances before expiration in AWS RDS using the AWS Management Console, follow these steps:
  1. Login to AWS Console: Go to the AWS Management Console at https://aws.amazon.com/ and login with your credentials.
  2. Navigate to RDS Service: Click on the “Services” dropdown menu at the top of the page, then select “RDS” under the Database section.
  3. Select Reserved Instances: In the left-hand navigation pane, click on “Reserved Instances” to view the list of your existing reserved instances.
  4. Identify Expiring Reserved Instances: Look for the Reserved Instances that are nearing expiration (within 30 days) in the list displayed.
  5. Select the Reserved Instance: Click on the checkbox next to the Reserved Instance that you want to renew before expiration.
  6. Click on Actions: At the top of the Reserved Instances page, click on the “Actions” dropdown menu.
  7. Select Renew Reserved Instances: From the Actions dropdown menu, select “Renew Reserved Instances”.
  8. Review and Confirm: Review the details of the renewal, including the term length and payment options. Confirm that you want to renew the Reserved Instance.
  9. Complete the Renewal Process: Follow the on-screen instructions to complete the renewal process. You may need to provide payment information if the renewal involves additional charges.
  10. Verify Renewal: Once the renewal process is complete, verify that the Reserved Instance now shows an updated expiration date that is beyond the next 30 days.
By following these steps, you can successfully renew your RDS Reserved Instances before they expire in AWS using the AWS Management Console.

To renew RDS Reserved Instances before expiration (30 days) in AWS using AWS CLI, follow these steps:
  1. List all the existing reserved instances to identify the ones that are expiring within the next 30 days:
aws rds describe-reserved-db-instances
  1. Identify the Reserved Instance that is expiring within the next 30 days and note down its Reserved Instance ID.
  2. Modify the existing Reserved Instance to renew it for another term. You can do this by using the modify-db-instance command:
aws rds modify-db-instance --db-instance-identifier your-db-instance-id --reserved-db-instance-id your-reserved-instance-id --reserved-db-instances-offering-id new-reserved-offering-id
Replace your-db-instance-id with the DB instance identifier, your-reserved-instance-id with the Reserved Instance ID, and new-reserved-offering-id with the ID of the new Reserved Instance offering.
  1. Verify that the Reserved Instance has been successfully renewed by describing the reserved instance again:
aws rds describe-reserved-db-instances
By following these steps, you can renew RDS Reserved Instances before expiration in AWS using the AWS CLI.
To remediate the misconfiguration of not renewing RDS Reserved Instances before expiration in AWS using Python, you can create a script that checks the expiration date of the reserved instances and automatically renews them if they are set to expire within the next 30 days. Here’s a step-by-step guide on how to do this:
  1. Install Boto3: Make sure you have the Boto3 library installed in your Python environment. Boto3 is the AWS SDK for Python and allows you to interact with AWS services.
    pip install boto3
    
  2. Create Python Script: Create a Python script (e.g., renew_rds_reserved_instances.py) with the following code:
    import boto3
    from datetime import datetime, timedelta
    
    # Initialize the RDS client
    rds_client = boto3.client('rds')
    
    # Get a list of all reserved instances
    reserved_instances = rds_client.describe_reserved_db_instances()
    
    # Check each reserved instance for expiration within the next 30 days
    for reserved_instance in reserved_instances['ReservedDBInstances']:
        expiration_date = reserved_instance['EndTime']
        days_until_expiration = (expiration_date - datetime.now()).days
    
        if days_until_expiration <= 30:
            # Renew the reserved instance
            response = rds_client.modify_reserved_db_instances(
                ReservedDBInstanceId=reserved_instance['ReservedDBInstanceId'],
                ReservedDBInstancesOfferingId=reserved_instance['ReservedDBInstancesOfferingId'],
                Duration=reserved_instance['Duration'])
            print(f"Renewed reserved instance {reserved_instance['ReservedDBInstanceId']}")
    
    
  3. AWS Credentials: Ensure that your AWS credentials are properly configured either through environment variables or ~/.aws/credentials file.
  4. Run the Script: Run the Python script using your preferred method (e.g., python renew_rds_reserved_instances.py). The script will check all your RDS reserved instances and renew those that are set to expire within the next 30 days.
By following these steps, you can automatically renew RDS Reserved Instances before they expire in AWS using Python.
I