More Info:
All Amazon RDS Reserved Instance (RI) purchases are reviewed every 7 days in order to confirm that no unwanted reservation purchase has been placed recently.Risk Level
LowAddress
Cost OptimisationCompliance Standards
CBPTriage and Remediation
Remediation
Using Console
Using Console
To remediate the misconfiguration of not reviewing RDS Reserved Instances purchases every 7 days in AWS using the AWS Management Console, follow these steps:
- Sign in to the AWS Management Console: Go to https://aws.amazon.com/ and sign in to your AWS account.
- Navigate to the RDS Service: Click on the “Services” dropdown menu at the top of the page, then select “RDS” under the Database category.
- Review Reserved Instances: In the RDS dashboard, locate the “Reserved Instances” option in the left-hand menu and click on it.
- Check Purchase History: Review the list of your Reserved Instances to ensure they have been purchased and are being utilized effectively. Look for any instances that may not be optimized or are not in use.
- Set Up a Reminder: To ensure that you review your Reserved Instances every 7 days, you can set up a reminder in the AWS Management Console. You can use AWS CloudWatch Events to create a rule that triggers a reminder notification every 7 days.
-
Create a CloudWatch Event Rule:
- Go to the AWS CloudWatch service in the AWS Management Console.
- Click on “Rules” in the left-hand menu and then click on “Create rule”.
- Under “Event Source”, select “Schedule”.
- Set the schedule to run every 7 days or as per your requirement.
- Under “Targets”, choose the target for your reminder notification (e.g., SNS topic, Lambda function).
- Click on “Configure details”, give your rule a name and description, and then click on “Create rule”.
- Monitor and Review: Ensure that you receive the reminder notifications every 7 days to review your RDS Reserved Instances purchases. Make any necessary adjustments to optimize your Reserved Instances based on your usage and requirements.
Using CLI
Using CLI
To remediate the misconfiguration of not reviewing RDS Reserved Instances purchases every 7 days in AWS using AWS CLI, follow these steps:
-
List all the Reserved Instances in AWS RDS:
Run the following AWS CLI command to list all the Reserved Instances in your AWS account:
-
Identify the Purchase Date of each Reserved Instance:
From the output of the previous command, note down the
OfferingType
andStartTime
values for each Reserved Instance. TheStartTime
field indicates when the Reserved Instance was purchased. -
Calculate the Age of Each Reserved Instance:
Calculate the age of each Reserved Instance by comparing the
StartTime
with the current date. If any Reserved Instance is older than 7 days, it needs to be reviewed. - Set up a Scheduled AWS Lambda Function: Create an AWS Lambda function that uses the AWS SDK to list all the Reserved Instances and their purchase dates. The Lambda function should compare the purchase date with the current date and send a notification if any Reserved Instance is older than 7 days.
- Create an AWS CloudWatch Event Rule: Set up a CloudWatch Event Rule that triggers the Lambda function on a schedule (e.g., every 7 days). This will automate the process of reviewing RDS Reserved Instances purchases regularly.
- Configure Notifications: Configure the Lambda function to send notifications (e.g., via Amazon SNS) to the appropriate stakeholders if any Reserved Instance needs to be reviewed.
Using Python
Using Python
To remediate the misconfiguration of not reviewing RDS Reserved Instances purchases every 7 days in AWS using Python, you can create a Lambda function that will be triggered by a CloudWatch Events rule on a 7-day schedule. Below are the step-by-step instructions to remediate this misconfiguration:
-
Create a Lambda Function:
- Go to the AWS Management Console and navigate to the Lambda service.
- Click on the “Create function” button.
- Choose the “Author from scratch” option.
- Provide a name for your function, select Python as the runtime, and choose an existing role with the necessary permissions or create a new one.
- Click on the “Create function” button.
-
Write Python Code:
- In the Lambda function code editor, write Python code to list all the RDS Reserved Instances and check their purchase date.
- You can use the AWS SDK for Python (Boto3) to interact with AWS services.
- Here is an example code snippet to get you started:
-
Set up CloudWatch Events Rule:
- Go to the AWS Management Console and navigate to the CloudWatch service.
- Click on “Rules” in the left-hand menu and then click on “Create rule”.
- Set the schedule expression to run every 7 days.
- Add a target for the rule and select the Lambda function you created earlier.
-
Test the Remediation:
- Manually trigger the Lambda function to ensure that it is correctly listing RDS Reserved Instances that need review.
- Verify that the CloudWatch Events rule triggers the Lambda function as expected every 7 days.