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:
- Check the requirements for your database engine.
- Use the Aurora and RDS console, AWS CLI, or RDS API to create a blue/green deployment.
- 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.
- 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:
- Create a new database.
- Launch a new database instance that has a smaller storage size than your existing database instance.
- Use your database engine's native tools to dump your existing database instance.
- (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.
- 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