Relational Database Service in AWS

Relational Database Service in AWS

Day 44

Relational Database

  • Amazon Relational Database Service (Amazon RDS) is a collection of managed services that makes it simple to set up, operate, and scale databases in the cloud.

Task-01

  • Create a Free tier RDS instance of MySQL

    1. Go to the Amazon RDS console. Click "Create database".

    2. Select "MySQL" as the engine type.

    3. Choose the "Free tier" template for the "DB instance class".

    4. Enter a unique name for the "DB instance identifier".

    5. Set the "Master username" and "Master password" for the database.

    6. Set the "Virtual Private Cloud (VPC)" and "Subnet group" to create the instance.

      Leave the other settings at their default values.

      Select ec2-instance

    7. Choose the VPC security group

    8. Click "Create Database" to start the instance creation.

    9. The database is created.

  • Create an EC2 instance

    1. Go to the Amazon EC2 console.

    2. Click "Launch Instance". Choose a Linux AMI.

    3. Choose an instance type, such as t2.micro. Choose a VPC and subnet.

    4. Configure security group rules to allow inbound traffic on the appropriate port for the type of database you are using (e.g. port 3306 for MySQL).

  • Create an IAM role with RDS access

    1. Go to the IAM console. Click "Roles". Click "Create role".

    2. Choose the 'AWS service'.

      Choose "Allows EC2 instances to call AWS services on your behalf".

    3. Attach the "AmazonRDSFullAccess" policy.

    4. Enter a unique name for the role.

    5. Click "Create role".

    6. Role is Created

  • Assign the role to EC2 so that your EC2 Instance can connect with RDS

    1. Go to the EC2 console.

      Select the instance you just created.

      Click "Actions", then "Security", then "Modify IAM Role".

    2. Choose the IAM role you just created.

      Click "Update IAM role".

  • Once the RDS instance is up and running, get the credentials and connect your EC2 instance using a MySQL client.

    1. Go to the RDS console.

      Select the instance you just created.

      Click "Connectivity and Security" and note the endpoint address.

    2. Click "Configuration" and note the username and password.

    3. SSH into your EC2 instance using a terminal or remote access tool.

    4. Install a MySQL client, such as "MySQL" using the command.

      sudo apt install mysql-client-core-8.0

    5. Connect to the RDS instance using the MySQL client and the endpoint address, username, and password:

       mysql -h <endpoint address> -P <port.no> -u <username> -p
        mysql -h database-1.cyzxd1zu9ohs.us-east-1.rds.amazonaws.com -P 3360 -u admin -p
      
    6. Enter the password when prompted and press enter.

    7. You should now be connected to the MySQL database on the RDS instance.

Thankyou....