AWS RDS Start and Stop Policy

Here’s a IAM policy that you can add to an IAM user or an IAM role so they are able to start and stop a specific RDS instance.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Condition": {
                "StringEqualsIgnoreCase": {
                    "rds:db-tag/Application": "application-name"
                }
            },
            "Action": [
                "rds:DescribeDBInstances",
                "rds:StartDBInstance",
                "rds:StopDBInstance"
            ],
            "Resource": "arn:aws:rds:us-east-1:xxxxxxxxxxxx:db:db-instance-name",
            "Effect": "Allow"
        }
    ]
}

Starting and Stopping Services

Linux is quite stable, but there are times that you may have to restart an application or a service after a configuration change. For the change to take effect, a restart of a service is required. The good news is starting and stopping services in Linux are quite easy.

The old way.

# Starting and stopping MySQL
$ sudo /etc/init.d/mysql start
$ sudo /etc/init.d/mysql stop
$ sudo /etc/init.d/mysql restart
# Starting and stopping Apache
$ sudo /etc/init.d/apache2 start
$ sudo /etc/init.d/apache2 stop
$ sudo /etc/init.d/apache2 restart
# Starting and stopping the network
$ sudo /etc/init.d/networking start
$ sudo /etc/init.d/networking stop
$ sudo /etc/init.d/networking restart

Via service for Debian|Ubuntu distros

# Starting and stopping MySQL
$ sudo service mysql start
$ sudo service mysql stop
$ sudo service mysql restart
# Starting and stopping Apache
$ sudo service apache2 start
$ sudo service apache2 stop
$ sudo service apache2 restart
# Starting and stopping the network
$ sudo service networking start
$ sudo service networking stop
$ sudo service networking restart

Via Systemctl for CentOS|Redhat distros

# Starting and stopping MySQL
$ sudo systemctl start mysqld
$ sudo systemctl stop mysqld
$ sudo systemctl restart mysqld
# Starting and stopping Apache
$ sudo systemctl start httpd
$ sudo systemctl stop httpd
$ sudo systemctl restart httpd
# Starting and stopping the network
$ sudo systemctl start network
$ sudo systemctl stop network
$ sudo systemctl restart network