Skip to content

How do I reduce the storage size and cost of my Amazon RDS database instance?

3 minute read
0

I want to reduce the storage size and cost of my Amazon Relational Database Service (Amazon RDS) database instance.

Short description

To reduce the cost of an Amazon RDS database instance, you can modify the allocated storage size of your instance. Use Amazon RDS Blue/Green Deployments to decrease your storage volumes. First, check that your AWS Region and database engine supports blue/green deployments.

If you can't use blue/green deployments, then you must create a new database instance that has a smaller allocated storage size. Then, take one of the following actions to migrate your data into a new database instance:

  • Use the database engine's native dump and restore method. This method causes downtime.
  • Use AWS Database Migration Service (AWS DMS) for minimal downtime.

Resolution

Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.

Use blue/green deployments to decrease your storage volumes

Complete the following steps:

  1. Check the requirements for your database engine.
  2. Use the Aurora and RDS console, AWS CLI, or RDS API to create a blue/green deployment.
  3. Use one of the following options to decrease the provisioned storage setting:
    Configure the setting in the Aurora and RDS console.
    For the AWS CLI, include the target-allocated-storage option in the create-blue-green-deployment command.
    For the RDS API, use the TargetAllocatedStorage parameter in the CreateBlueGreenDeployment operation.
    Important: Set the allocated storage target to at least 20% more than your current storage usage, not your current storage setting.
  4. Perform a switchover so that the green environment becomes the blue environment.

Create a new database instance that has a smaller provisioned storage size and migrate your data

Complete the following steps:

  1. Create a new database.
  2. Launch a new database instance that has a smaller storage size than your existing database instance.
  3. Use your database engine's native tools to dump your existing database instance.
  4. (Optional) You can rename your old database instance, and then name the new database instance with the old database instance's name. Or, reconfigure applications to use the new database instance's name.
  5. Restore the database in your new database instance.

To restore your database, use one of the following methods:

Note: After your old database instance no longer receives connections, downtime occurs until Amazon RDS directs the connections to your new database instance.

Replicate your database instance with AWS DMS

You can use AWS DMS to set up homogeneous replication between your two database instances.

Related information

Amazon RDS Blue/Green Deployments support storage volume shrink

Sources for AWS DMS

Targets for AWS DMS

Restoring to a DB instance

4 Comments

that's a bummer, is there no option to have RDS do the dump/restore or export/import? :( If the patching exercise can be actioned, dump/restore can be too. Obviously the size of the database matters, maybe an enhancement or feature at least for small sized DBs.

replied 2 years ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

AWS
EXPERT
replied 2 years ago

It is weird that AWS can change storage options from I01,GP2 or GP3 with a simple click of button. But when you spend weeks cleaning up your Cloud Oracle RDS tablespaces and your Free-Storage-Space is now 3x times bigger than your data (in the Terabytes). There is no simple resize leaving just 25% as Free-Storage-Space.

https://docs.aws.amazon.com/ebs/latest/userguide/ebs-volumes.html they claim "AWS EBS volumes are flexible." but not that flexible ;-)

replied 2 years ago

Blue/Green does not work for this as of now. It forces a storage optimisation that seemingly randomly increases the size

replied a year ago