Docs/How do I automatically stop an RDS database outside business hours?

How do I automatically stop an RDS database outside business hours?

Put a dev or staging Amazon RDS database to sleep at night and on weekends, start it again before work, and verify the result with the AWS CLI.

When this applies

  • Development, staging, QA, and demo RDS DB instances that nobody uses at night or on weekends.
  • Standard RDS DB instances. SnoozeDB never schedules Aurora or Multi-AZ DB cluster members; they stay Protected.
  • Not production. Keep production databases Protected (see the guide on protecting production).

AWS cannot stop every instance. For example, an instance that is a read replica, or that has one, cannot be stopped. Check the AWS limitations for stopping a DB instance before you plan savings.

Steps

  1. Create a SnoozeDB workspace. The free Dev plan manages one RDS database.
  2. Open Cloud integrations, enter the 12-digit AWS account ID, and deploy the generated CloudFormation stack. It creates the SnoozeDBAccessRole IAM role, which SnoozeDB assumes through AWS STS with a unique External ID. No access keys are shared.
  3. Run Sync Now. New databases appear in To triage; nothing is scheduled until you decide.
  4. Choose Manage on the staging database to move it to Managed resources.
  5. Assign Business Hours and check the timezone, for example Europe/Paris. Daylight saving time changes are handled automatically.
Monday to Friday   08:00 ---- running ---- 20:00
                   20:00 ---- stopped ---- 08:00
Saturday, Sunday   stopped all day
Expected state with the default Business Hours schedule

Verify the result

After the first stop window, check the instance status from a terminal with read access to the account:

aws rds describe-db-instances \
  --db-instance-identifier staging-db \
  --query 'DBInstances[0].DBInstanceStatus' \
  --output text
# "stopped" outside the active window, "available" inside it

Each start and stop also appears in SnoozeDB Activity Logs, including skipped and failed actions.

Estimate the savings

Running hours:  12 h x 5 days        = 60 h per week
Stopped hours:  168 h - 60 h         = 108 h per week (about 64%)
Monthly hours stopped: 108 x 52 / 12 = 468 h
db.t3.medium at $0.068/h (example on-demand rate): 468 x 0.068 = about $31.80 saved per month

If nothing happens at the expected time

  • The database is in Managed resources, not To triage or Protected.
  • The schedule timezone, weekdays, start time, and stop time are the ones you expect.
  • The database is not locked and has no active temporary start.
  • Activity Logs show a skipped, failed, or successful action at the boundary.
  • Run a sync if the status in SnoozeDB no longer matches the AWS console.