Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reduce storage(scale down) my RDS instance?

I have a RDS(Postgres) instance with Storage SSD 1000GB, but the data is only 100GB of size.

How can I scale down the storage resource of RDS easily ?

like image 345
Hello lad Avatar asked Apr 20 '16 14:04

Hello lad


People also ask

How do I lower my RDS storage?

RDS does not allow you to reduce the amount of storage allocated to a database instance, only increase it. To move your database to less storage you would have to create a new RDS instance with your desired storage space, then use something like pg_dump/pg_restore to move the data from the old database to the new one.

Can you change RDS instance size?

You can vertically scale up your RDS instance with a click of a button. Several instance sizes are available, from general purpose to CPU and memory optimized, when resizing in Amazon RDS for MySQL, Amazon RDS for PostgreSQL, Amazon RDS for Maria DB, Amazon RDS for Oracle, or Amazon RDS for SQL Server.

Can we scale RDS server?

RDS Storage Auto Scaling automatically scales storage capacity in response to growing database workloads, with zero downtime.


3 Answers

RDS does not allow you to reduce the amount of storage allocated to a database instance, only increase it.

To move your database to less storage you would have to create a new RDS instance with your desired storage space, then use something like pg_dump/pg_restore to move the data from the old database to the new one.

Also be aware that an RDS instance with 1,000GB of SSD storage has a base IOPS of 3,000. An RDS instance with 100GB of SSD storage has a base IOPS of 300, with occasional bursts of up to 3,000.

like image 149
Mark B Avatar answered Sep 25 '22 04:09

Mark B


Based on AWS's help here, this is the full process that worked for me:

1) Dump the database to a file: run this on a machine that has network access to the database: pg_dump -Fc -v -h your-rds-endpoint.us-west-2.rds.amazonaws.com -U your-username your-databasename > your-databasename.dump

2) In the AWS console, create a new RDS instance with smaller storage. (You probably want to set it up with the same username, password, and database name.)

3) Restore the database on the new RDS instance: run this command (obviously on the same machine as the previous command): pg_restore -v -h the-new-rds-endpoint.us-west-2.rds.amazonaws.com -U your-username -d your-databasename your-databasename.dump

(Note, in step 3, that I'm using the endpoint of the new RDS instance. Also note there's no :5432 at the end of the endpoint addresses.)

like image 18
Luke Avatar answered Sep 21 '22 04:09

Luke


Amazon doesn't allow to reduce size of HDD of RDS instance, you may have two options to reduce size of storage.

1:-if you can afford downtimes, then mysqldump backup of old instance can be restored to new instance having lesser storage size.

2:- You can use Database migration service to move data from one instance to another instance without any downtime.

like image 7
Sudhir Shekhsaria Avatar answered Sep 21 '22 04:09

Sudhir Shekhsaria