How to Remediate Amazon RDS Idle Instances with Stratusphere™ FinOps

Learn to reduce AWS costs with Stratusphere™ FinOps by efficiently remediating idle Amazon RDS instances, plus strategies to optimize your RDS resources.

Need additional support?


Amazon Relational Database Service (RDS) is a managed service that allows you to easily deploy database servers for your applications.

RDS supports a variety of open source database engines, including MySQL, MariaDB, and PostgreSQL. Other proprietary database engines are supported, including Microsoft SQL Server, Oracle, and IBM Db2. When you’re building a business application, using RDS for your database reduces the amount of effort required to spin it up and maintain it over its lifecycle.

Amazon RDS Instance Sizing

When you deploy a new Amazon RDS instance, you can select an “instance type” which allocates a certain number of virtual CPUs and memory to your database server. This service is built on top of Amazon EC2, so you’ll see some of the same instance types available in RDS.

The costs for each instance type varies; more vCPUs and memory results in a higher cost. Some instance types are intended for databases that consume large amounts of memory, but don’t necessarily need a significant number of CPU cores.

Check out the Amazon RDS pricing page for full details on the available instance types.

When you resize an Amazon RDS instance, it must be shutdown and rebooted to apply the new instance type. This reboot is handled by the RDS service once you apply the change. The RDS service defers instance class changes to a scheduled maintenance window, or you can elect to apply the change immediately.

One unique feature of the Amazon RDS service is that you can easily switch from Intel / AMD 64-bit CPU architectures to ARM-based Graviton CPUs, or vice versa. The instance classes that end with a “g” indicate that they use Graviton CPUs. For example, t4g, m7g, and r7g, are all Graviton-powered RDS instance classes.

Identify Cost Risks

Stratusphere™ FinOps is a SaaS application that helps you identify cost savings opportunities in the cloud, across your entire organization. To find specific cost savings opportunities for RDS DB instance resizing, head over to the Findings section. Then, specify the Amazon Relational Database Service under the Service filter, and choose Efficiency under the Categories.

The specific Finding that you’re looking for is called “Amazon RDS Idle DB Instances.” This will inform you of any RDS instances that have not had a database connection for 7 days or more. Under the Resource ID column, you can see the Amazon Resource Name (ARN) of the specific RDS database instance that is idle.

Stratuspheres Findings Dashboard

After you’ve identified the list of RDS instances that are ripe for deletion or down-sizing, you can run through the steps in the Remediation section below.

Risks & Other Considerations

Before you resize an Amazon RDS database instance, there are several risks and other details that you should be aware of.

  • Deleting an Amazon RDS instance can result in data loss. You can elect to take a final snapshot before deletion, or skip this behavior.
  • Resizing an Amazon RDS instance requires downtime of the database.
  • You can scale up or scale down the RDS instance class.
  • RDS instance classes are a subset of EC2 instance types. In other words, not all EC2 instance types can be used in RDS.
  • Resizing an RDS instance can be done immediately, or staged for implementation during a maintenance window.
  • Modifying an RDS instance can also change other settings, such as the TCP port number, database engine version, deletion protection, and more.
  • Serverless RDS options are not available for all database engines and versions but can be very helpful for bursty workloads.


To remediate Amazon RDS idle instances, simply remove the database server from your AWS account. 

Delete RDS Instance

To delete an RDS instance from your account, you can follow these steps.

  1. Open the AWS Management Console
  2. Select the appropriate AWS region, in the top-right corner
  3. Navigate to the Amazon RDS service
  4. Select your server, under the Databases section
  5. Select the ActionsDelete menu option
  6. Uncheck the Create Final Snapshot checkbox (if desired)
    1. Check the Backup / Snapshot Acknowledgement checkbox
  7. Type the confirmation text and click the Delete button

After initiating the process, it may take a few minutes for your Amazon RDS instance to be deleted.

Resize RDS Instance

You can also consider resizing your RDS instances, after they’ve been provisioned. This technique allows you to scale down your database servers, therefore reducing cloud spend, but still keeping the database accessible to business applications.

Follow these steps to resize your Amazon RDS instance.

  1. Open the AWS Management Console
  2. Select the appropriate AWS region, in the top-right corner
  3. Navigate to the Amazon RDS service
  4. Select your server, under the Databases section
  5. Click on the Modify button
  6. Under Instance Configuration, choose a new DB Instance Class
  7. Click the Continue button at the bottom
  8. Select the Apply Immediately radio button
  9. Click the Modify DB Instance button

After following the above steps, your Amazon RDS instance will be resized in the background. It will take several minutes to perform the resizing operation. This resize operation will result in downtime for your database. Make sure you plan this change and notify users about application outages in advance.

Automated Remediation

You can use automation tools for AWS, such as the AWS CLI or AWS PowerShell module, to delete or resize Amazon RDS instances. The API call that deletes RDS instances is called DeleteDBInstance, and the API that modifies the Amazon RDS instance type is called ModifyDBInstance. You can find a list of the supported DB instance classes in this AWS documentation.

As with any AWS automation, you’ll need to configure your AWS credentials in order to access the AWS APIs for your account.

AWS CLI Commands

You can use the AWS CLI tool to perform remediations across a large number of Amazon RDS instances. This is especially useful to automate if you’re dealing with many instances split across different AWS regions and accounts.

By default, RDS takes a final snapshot, before deleting the RDS instance, to prevent data loss. You can optionally skip this snapshot, using the parameter shown.

By default, the AWS CLI produces paged output, but this is not desirable for silent automation scripts. Use the --no-cli-pager parameter to alter this behavior.

aws rds delete-db–instance --db-instance-identifier stratusgrid01 --skip-final-snapshot --no-cli-pager

If you are sure that you need to keep the RDS instance around, you can resize it to a smaller, less expensive DB instance type. The command below shows how to accomplish this.

aws rds modify-db-instance --db-instance-identifier stratusgrid01 --db-instance-class db.t3.small --apply-immediately

If you do not have a default region set, or need to target a different region, you can also specify the region that you’re operating against, by using the --region parameter.

AWS PowerShell Commands

You can use the AWS RDS module for PowerShell to automate RDS instance deletion. You’ll want to use the Remove-RDSDBInstance command, in the AWS.Tools.RDS module. Make sure you specify the RDS instance name, and skip the final snapshot, if desired. The -Force parameter prevents interactive confirmation prompts from popping up during script execution.

Remove-RDSDBInstance -DBInstanceIdentifier stratusgrid01 -SkipFinalSnapshot $true -Force

If you’re confident that you need to keep the RDS instance in your account, you can reduce spend by resizing it to a smaller RDS instance type. The Edit-RDSDBInstance PowerShell command allows you to modify the configuration of an existing RDS instance.

Edit-RDSDBInstance -DBInstanceIdentifier stratusgrid01 -DBInstanceClass db.t4g.micro -ApplyImmediately $true

You can use the -Region parameter for AWS PowerShell commands to specify an alternative region, depending on where the RDS instance resides.

Potential Errors

Depending on the API call you make, to change the configuration of your Amazon RDS instance, you might receive different error messages. Let’s take a look at a couple of errors and how to resolve them.

  • Error: DB instance not found: stratusgrid01
    • Resolution: This error can occur if you are querying the incorrect AWS account, or AWS region, where the RDS instance resource resides. It’s good practice to specify the region in your API calls, rather than depending on the default region from your AWS SDK configuration.
  • Error: Database instance is not in available state
    • Resolution: If you’ve just created a brand new RDS database instance, or just applied modifications to a running RDS instance, it takes several minutes for the process to complete. Wait until the RDS database instance has changed back to the “Available” state, and retry the automation command.
  • Error: Invalid DB Instance class: t4g.micro
    • Resolution: This error can occur if the desired RDS instance class is not available in the region you’re targeting. Another reason you might see this error is if you forgot to prefix the RDS instance class with “db.” Remember that RDS instance classes have a prefix on them, unlike their EC2 counterparts. You’d want to use “db.t4g.micro” instead of just “t4g.micro”, for example.
  • Error: Instance stratusgrid01 is currently creating - a final snapshot cannot be taken.
    • Resolution: If you try to delete an Amazon RDS instance that’s still being initially created, you may receive this error message. This occurs because a snapshot can’t be created in the midst of a creation operation. You can either wait until the RDS instance has finished being created, or you can specify the parameter to skip taking a final snapshot, which will forcibly destroy the RDS instance.
  • Error: Instance stratusgrid01 is already being deleted.
    • Resolution: This error message will appear if an Amazon RDS instance has already been triggered for deletion. There’s nothing else you should need to do at this point. If the RDS instance has somehow hung during deletion (unlikely), then submit a support request to AWS in your account.

Optimize Your AWS Spend with Stratusphere™ FinOps by StratusGrid

You can save large amounts of potential spend, across your entire AWS Organization, by identifying unused Amazon RDS instances with Stratusphere™ FinOps, and cleaning them up. The effort required to delete an RDS instance is very low, making it an easy way to reduce your monthly cloud spend.

For applications with certain data schemas, you may want to consider modernizing your architecture with a fully-managed NOSQL database. Using a managed database service, such as Amazon DynamoDB, can simplify cost and performance scaling with its on-demand performance mode.

StratusGrid can consult with you to strategize and implement a modernized architecture for your cloud workloads. Contact us today for more information.

See Stratusphere™ FinOps in action here:


Similar posts