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:
- Use the Amazon 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 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.
- 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:
- Open the Amazon RDS console.
- In the navigation pane, choose Databases.
- Choose Create database.
- Launch a new DB instance that has a smaller storage size than your existing DB instance.
- Use your database engine's native tools to dump your existing DB instance.
- (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.
- 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