I want to decrease the total allocated storage size of my Amazon Relational Database Service (Amazon RDS) DB instance. How can I do this?
Short description
After you create an Amazon RDS DB instance, you can't modify the allocated storage size of the DB instance to decrease the total storage space it uses. To decrease the storage size of your DB instance, create a new DB instance that has less provisioned storage size. Then, migrate your data into the new DB instance using one of the following methods:
- Use the database engine's native dump and restore method. This method causes some downtime.
- Use AWS Database Migration Service (AWS DMS) for minimal downtime.
Resolution
DB dump and restore
- Open the Amazon RDS console, and then choose Databases from the navigation pane.
- Choose Create database.
- Launch a new Amazon RDS 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 (the instance you want to decrease in size).
- Optionally, you can rename your old DB instance, and then name the new DB instance using the old DB instance's name. Or, you can reconfigure applications to use the new DB instance's name.
- Restore the database in your new DB instance.
To restore your database, you can use the pg_dump utility for PostgreSQL or for PostgreSQL versions 10.10 and later, and 11.5. Or, you can use Transportable Databases, which moves data much faster than the pg_dump/pg_restore method. The mysqldump utility is available for importing data into MySQL/MariaDB engines, or you can use the external replication method for reduced downtime. Similarly, you can use Data Pump for Oracle and native full backup (.bak files) for SQL Server.
Note: Downtime occurs from the time that your old DB instance stops receiving connections until the time that Amazon RDS directs the connections from your application to the new DB instance.
Replication with AWS DMS
You can use AWS DMS to set up homogeneous replication between your two DB instances. For more information, see Getting started with AWS Database Migration Service.
Related information
Sources for AWS Database Migration Service
Targets for AWS Database Migration Service
Restoring from a DB snapshot
Amazon RDS pricing