/home/sangvo

Search

Search IconIcon to open search

TIL: EventBridge start/stop aurora automation

Last updated Apr 7, 2023 Edit Source

When you stop Amazon RDS instances (including Aurora), they are automatically started after 7 days. In  the aws doc, you will find this notice.

You can stop a DB instance for up to seven days. If you don’t manually start your DB instance after seven days, your DB instance is automatically started so that it doesn’t fall behind any required maintenance updates.

# For EC2

Create policy

 1{
 2    "Version": "2012-10-17",
 3    "Statement": [
 4        {
 5            "Sid": "VisualEditor0",
 6            "Effect": "Allow",
 7            "Action": [
 8                "ec2:StartInstances",
 9                "ec2:StopInstances"
10            ],
11            "Resource": "*"
12        }
13    ]
14}

name: eventbridge_automation_ec2_policy

# For Aurora

 1{
 2    "Version": "2012-10-17",
 3    "Statement": [
 4        {
 5            "Sid": "RDSDescribe",
 6            "Effect": "Allow",
 7            "Action": [
 8                "rds:DescribeDBClusters"
 9            ],
10            "Resource": [
11                "*"
12            ]
13        },
14        {
15            "Sid": "RDSControl",
16            "Effect": "Allow",
17            "Action": [
18                "rds:StartDBCluster",
19                "rds:StopDBCluster"
20            ],
21            "Resource": [
22                "*"
23            ]
24        }
25    ]
26}

name: eventbridge_automation_rds_policy

# EventBridge

https://dev.to/aws-builders/easy-setup-for-ec2-stop-jobs-with-amazon-eventbridge-scheduler-4lpg