More Info:
Identify any Amazon RDS database instances that appear to be underutilized and downsize (resize) them to help lower the cost of your monthly AWS billRisk Level
LowAddress
Cost OptimisationCompliance Standards
CBPTriage and Remediation
Remediation
Using Console
Using Console
To remediate the issue of underutilized RDS instances in AWS, follow these steps using the AWS Management Console:
-
Identify Underutilized RDS Instances:
- Navigate to the AWS Management Console and open the Amazon RDS console.
- Click on “Databases” from the left-hand menu to view all your RDS instances.
- Look for instances with low CPU utilization, low memory usage, or low storage usage compared to their allocated resources.
-
Modify Instance Type:
- Select the underutilized RDS instance that you want to remediate.
- Click on the “Modify” button at the top to change the instance type.
- Choose a more appropriate instance type based on the workload requirements and expected usage patterns.
- Click on “Apply immediately” to apply the changes.
-
Enable Auto Scaling:
- In the RDS console, select the RDS instance that you want to enable Auto Scaling for.
- Click on the “Modify” button to make changes to the instance.
- Scroll down to the “Auto Scaling” section and click on “Enable Auto Scaling”.
- Configure the minimum and maximum values for CPU utilization that should trigger scaling actions.
- Click on “Apply immediately” to save the changes.
-
Implement Performance Insights:
- Performance Insights helps you identify performance issues and underutilized resources in your RDS instance.
- In the RDS console, select the instance you want to monitor.
- Click on the “Modify” button and scroll down to the “Enable Performance Insights” section.
- Enable Performance Insights and set the data retention period.
- Click on “Apply immediately” to save the changes.
-
Monitor and Optimize:
- Regularly monitor the performance metrics of your RDS instances using CloudWatch or Performance Insights.
- Adjust the instance type, storage, and other configurations based on the actual workload requirements.
- Consider implementing RDS Proxy for connection pooling and better resource utilization.
Using CLI
Using CLI
To remediate the issue of underutilized RDS instances in AWS using AWS CLI, you can follow these steps:
-
Identify Underutilized RDS Instances:
- Use the AWS CLI command
describe-db-instances
to get information about all your RDS instances. - Look for instances with low CPU utilization, low memory utilization, or high idle time.
- Use the AWS CLI command
-
Modify RDS Instance:
- Use the AWS CLI command
modify-db-instance
to resize the instance to a more appropriate size based on your workload requirements. - Increase the instance size to utilize more CPU and memory resources if the current instance is underutilized.
- Use the AWS CLI command
-
Enable Auto Scaling:
- Configure Auto Scaling for your RDS instances to automatically adjust the instance size based on the workload.
- Use the AWS CLI command
modify-db-instance
with the--enable-auto-scaling
parameter to enable Auto Scaling for the RDS instance.
-
Monitor and Optimize:
- Regularly monitor the performance metrics of your RDS instances using CloudWatch.
- Optimize the database configuration, queries, and indexes to improve performance and resource utilization.
-
Implement Cost Optimization:
- Consider Reserved Instances or Savings Plans to reduce costs for your RDS instances.
- Use the AWS CLI command
purchase-reserved-db-instances-offering
to purchase Reserved Instances for your RDS instances.
Using Python
Using Python
To remediate underutilized RDS instances in AWS using Python, you can automate the process by creating a Lambda function that checks the CPU utilization of the RDS instances and modifies the instance class if the utilization is consistently low. Here’s a step-by-step guide on how to achieve this:
-
Setting Up AWS Lambda Function:
- Create a new Lambda function in the AWS Management Console.
- Choose Python as the runtime for your function.
-
IAM Role for Lambda Function:
- Create a new IAM role with the necessary permissions to describe RDS instances and modify them.
- Attach the IAM role to the Lambda function.
-
Code for Lambda Function:
- Write Python code in the Lambda function to describe RDS instances and check their CPU utilization.
- If the CPU utilization is consistently low, modify the instance class using the modify_db_instance API.
-
CloudWatch Alarms:
- Set up CloudWatch alarms to monitor the CPU utilization of RDS instances.
- Trigger the Lambda function when the utilization is consistently low.
-
Testing and Monitoring:
- Test the Lambda function to ensure it correctly identifies and modifies underutilized RDS instances.
- Monitor the performance of RDS instances after modification to verify the effectiveness of the remediation.