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

3 minute read
0

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

Short description

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

If you can't use blue/green deployments, then you can't modify the provisioned storage size of your DB instance. Instead, create a new DB instance that has a smaller provisioned storage size.

Then, take one of the following actions to migrate your data into a new DB 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

Use blue/green deployments to decrease your storage volumes

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.

Before you begin, check the requirements for your DB engine.

Complete the following steps:

  1. Use the Amazon RDS console, AWS CLI, or RDS API to create a blue/green deployment.
  2. Use one of the following options to decrease the provisioned storage setting:
    Configure the setting in the Amazon 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.
    Note: When you decrease your storage, set the allocated storage target to at least 20% more than your current storage usage, not your current storage setting.
  3. After you modify the green instance, perform a switchover so that the green environment becomes the blue environment.

DB dump and restore

To create a new DB instance that has a smaller provisioned storage size and migrate your data, complete the following steps:

  1. Open the Amazon RDS console.
  2. In the navigation pane, choose Databases.
  3. Choose Create database.
  4. Launch a new DB instance that has a smaller storage size than your existing DB instance.
  5. Use your database engine's native tools to dump your existing DB instance.
  6. (Optional) You can rename your old DB instance, and then name the new DB instance with the old DB instance's name. Or, reconfigure applications to use the new DB instance's name.
  7. Restore the database in your new DB instance.

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

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

Replication with AWS DMS

You can use AWS DMS to set up homogeneous replication between your two DB 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

3 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 a year ago

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

profile pictureAWS
EXPERT
replied a year 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 10 months ago