In this lab I will work with RDS, use EC2 instance to run queries and Session Manager to connect.

Services Covered

  • SystemsManager Systems Manager

Lab description

In this lab I will create a RDS database in a DB Subnet Group. I will use an EC2 instance to run queries against the database. I will use Session Manager to start a session on an running EC2 instance.

Learning Objectives

  • Create a DB Subnet Group
  • Create a MySQL Database in RDS
  • Run queries against database using Session Manager

Lab date



  • AWS account
  • An EC2 Instance running

Lab steps

  1. In the RDS dashboard go to Subnet groups and create DB Subnet Group. Select all available AZ and subnets.
  2. Go to the VPC dashboard and then Security Groups and create a new security group. This secuiry group will allow acces to the database.
  3. Back in the RDS dashboard create a database. Choose MySQL Free tier template. Set up the name, user and password, choose db.t2.micro instance class, disable storage autoscaling. In the Connectivity section choose the Security Group created in previous step. In the Additional configuration give the db an Initial name, uncheck the automatic backups. Leave all the other fields as default.
  4. Navigate to Systems Manager and then to Session Manager and start a session. Choose the running EC2 Instance. When in shell session change the role by running:
    sudo -i -u ec2-user
  5. Install the mysql client:
    sudo yum -y install mysql

  6. Navigate to the RDS Databases view and copy the endpoint:
  7. In your session, run the following command replacing with the endpoint you noted earlier:
    mysql -h <<>> -u cloudacademy -p rdsappdb

  8. Create a new table by executing this command:
    CREATE TABLE laboratory ( id INT, name VARCHAR(100) );
  9. Verify that your table was created by executing this command:
    DESC laboratory;
  10. Close your database connection by executing this command:
  11. Back in the RDS Console click Databases and delete the earlier created database.

Lab files