Blog

Optimizing Costs

Apr 16, 2024

In our development environment, we use an RDS - Aurora PostgreSQL database hosted on AWS to manage our data efficiently. However, we recently noticed that keeping RDS running around the clock was significantly increasing our monthly cloud bill. To tackle this, we implemented a simple solution: schedule RDS to shut down after 6 PM and start again at 9 AM the next day. This basic measure saved me $40 a month.

Step by Step: Setting Up the Automatic RDS Shutdown

Creating a Permission

a. Go to IAM

Image description

b. In the sub menu, open Policies

c. Click Create Policy:

Image description

d. In the Policy editor, paste the following and click Next:

 {
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "rds:Describe*",
                "rds:Start*",
                "rds:Stop*",
                "rds:Reboot*"
            ],
            "Resource": "*"
        }
    ]
}

e. Click Create policy

Image description

f. With the policy created, open Roles in the sub menu g. Click Create Role

Image description

h. Choose the Custom trust policy option and click next

Image description

i. Select the permission created earlier and click next.

Image description

j. Confirm the details and click Create role

Image description

k. Go to Systems Manager

Image description

Creating an Association

a. In the submenu, open State Manager and click Create association:

Image description

b. The first field is the name you want to give the association. E.g.: StopRds c. In the Document section, search for AWS-StartStopAuroraCluster

Image description

d. In the Input parameters section, fill in the name of the RDS cluster you want to start, and the role we created in the previous step

Image description

e. In the Specify schedule section, set the time the action should run, keeping in mind that it uses UTC.

Image description

f. Finally, click Create Association

Repeat the association step, changing step d. to select stop as the action

With these settings in place, your RDS will be shut down automatically at 6 PM and restarted at 9 AM every day, saving resources and reducing your AWS costs.


If you need to run the action immediately, you can do so from the list of Associations.

I hope this guide helps you optimize your AWS costs while keeping operations efficient. If you have any questions or want to share your experience with this tip, feel free to leave a comment below. I’m here to help!

Thanks for reading.

Request a quote

Tell me about your project and I'll get back to you by email.