How to keep an RDS database stopped for more than 7 days

Updated · 4 min read

You stopped a test database to save money, and a week later it was running again. That's by design: RDS lets a database instance, or an Aurora cluster, stay stopped for seven days in a row, then starts it again so it doesn't fall behind on maintenance. There's no setting to switch that off.

Stopped isn't free, either. While it's stopped you don't pay for the database's hours, but you still pay for its storage (including any Provisioned IOPS), its backups and snapshots, and its public IPv4 address if it's publicly accessible.

When will it start again?

aws rds describe-db-instances \
  --query 'DBInstances[].[DBInstanceIdentifier, DBInstanceStatus, AutomaticRestartTime]' --output text

For Aurora, ask about clusters instead:

aws rds describe-db-clusters \
  --query 'DBClusters[].[DBClusterIdentifier, Status, AutomaticRestartTime]' --output text

When RDS starts a DB instance for this reason, it records the event RDS-EVENT-0154: "DB instance is being started due to it exceeding the maximum allowed time being stopped".

Option 1: snapshot it and delete it

If you won't need the database for a few weeks, this is the cheapest way: you pay only for the snapshot's storage, and restore it when you need it again.

In the console: RDS → Databases, select the database, then Actions → Delete. Leave Create final snapshot ticked and give the snapshot a name. If deletion protection is on, modify the database to turn it off first.

With the AWS CLI:

aws rds delete-db-instance --db-instance-identifier test-db \
  --final-db-snapshot-identifier test-db-final

Automated backups are deleted along with the database unless you choose to keep them, so the final snapshot is your copy. When you need the database back:

aws rds restore-db-instance-from-db-snapshot \
  --db-instance-identifier test-db \
  --db-snapshot-identifier test-db-final \
  --vpc-security-group-ids sg-0123456789abcdef0

A restored database starts out with your VPC's default security group and as a single-AZ deployment unless you say otherwise, so pass the security group your app expects (as above) and check the other settings once it's up. For Aurora, delete the cluster's instances, then the cluster with aws rds delete-db-cluster --db-cluster-identifier test-cluster --final-db-snapshot-identifier test-cluster-final.

Option 2: stop it again on a schedule

If the database has to stay around, have something stop it again after AWS starts it. EventBridge Scheduler can call RDS's StopDBInstance directly, with no code:

  1. Open Amazon EventBridge → Scheduler → Schedules and click Create schedule.
  2. Make it a recurring schedule: once a day, or every few hours if you want less time running.
  3. For the target, choose All APIs, then Amazon RDS, then StopDBInstance, and put your database's identifier in the input the console fills in. For Aurora, use StopDBCluster.
  4. Give it an execution role that's allowed rds:StopDBInstance (or rds:StopDBCluster) on that database, and create it.

When the database is already stopped, the call just fails and nothing changes, so running it often does no harm. The catch: it also stops the database when you've started it on purpose, so disable the schedule while you're using it. AWS's Knowledge Center has a more involved version that uses Step Functions to react to the restart event.

Option 3, for Aurora: let it pause by itself

Aurora Serverless v2 can scale to zero and pause when nobody is connected. Set the cluster's minimum capacity to 0 ACUs and choose how long it must be idle first, from five minutes to a day. While it's paused, you pay nothing for its capacity; storage is still billed. The next connection wakes it, which typically takes about 15 seconds, or longer after a day or more asleep. It needs a recent engine version (Aurora PostgreSQL 13.15, 14.12, 15.7 or 16.3 and later, or Aurora MySQL 3.08 and later), and an RDS Proxy or any client that holds a connection open keeps it awake.

When it can't be stopped at all

  • An RDS instance that has a read replica, or is one.
  • RDS for SQL Server in a Multi-AZ deployment.
  • An Aurora cluster with a cross-region read replica, one of several clusters in a global database, or part of a blue/green deployment.

For these, Option 1 is the way to stop paying.

Or in Cloud GUI

Cloud GUI's Databases page lists every RDS and Aurora database in every region with its status, alongside your DynamoDB tables and Aurora DSQL clusters. A stopped database's page says that you're still paying for its storage and the date AWS will start it again by itself, and the free checkup lists every stopped database with that date, so a test database doesn't quietly come back and start billing by the hour. Cloud GUI doesn't start, stop or delete databases: do that in the RDS console or with the commands above. For everything else that keeps billing, see how to stop all AWS charges.

See your whole AWS account in one calm view

Cloud GUI shows your files and functions from every region at once, in plain English, with what's failing up front. It connects with a read-only role you create and can delete any time. Free for one AWS account.

More guides

Free tool
IAM policy explainer

Paste an IAM policy and read it in plain English, with the risky parts flagged. It runs in your browser; nothing is sent anywhere.