Relational Database Service in AWS

Relational Database Service in AWS

Welcome back, dear readers🌟

You might recall my previous blog on "S3 Programmatic Access with AWS-CLI." In case you missed it, feel free to catch up here.

Today, we talk about the Relational Database Service (RDS) in AWS. As we continue to explore more about cloud computing, RDS stands out as a crucial service for managing relational databases effortlessly.

Relational Database Service (RDS)

RDS is a fully managed database service that handles routine database tasks such as backups, patch management, and scaling, allowing you to focus on building and optimizing your applications.

RDS supports a variety of database engines, including MySQL, PostgreSQL, Oracle, SQL Server, and MariaDB. It provides automated backups, high availability with Multi-AZ deployments, and the flexibility to scale your database resources based on demand.

With RDS, you can offload the administrative overhead, ensuring that your databases are secure, highly available, and performant.

Task 01

Create an EC2 instance

  1. Go to the AWS login page and log in as Root user.

  2. Enter "EC2" in the search box.

  3. Select "Launch Instance."

  4. Select a Linux AMI, pick an instance type, such as t2.micro, and choose a VPC and subnet.

  5. Set up security group rules to permit inbound traffic on the relevant port for the type of database you are using (e.g., port 3306 for MySQL).

  6. Launch the instance.

Create a Free tier RDS instance of MySQL

  1. Go to the Amazon RDS console and select "Create database."

  2. Choose "MySQL" as the engine type.

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

  4. Provide a distinctive name for the "DB instance identifier."

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

  6. Configure the "Virtual Private Cloud (VPC)" and "Subnet group" for creating the instance.

  7. Maintain the default values for the other settings.

  8. Choose the EC2 instance that you want to create a snapshot of.

  9. Select the VPC security group.

  10. Click "Create database" to initiate the instance creation process.

  11. The database has been successfully created.

Create an IAM role with RDS access.

  1. Navigate to the IAM console, click on "Roles," and then select "Create role."

  2. Choose 'AWS service' and choose "Allows EC2 instances to call AWS services on your behalf."

  3. Attach the "AmazonRDSFullAccess" policy to the role.

  4. Provide a unique name for the role.

  5. Click "Create role" to finalize the role creation.

  6. The role has been successfully created.

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

  1. Access the EC2 console and choose the instance you have just created.

  2. Click on "Actions," then go to "Instance Settings," and select "Attach/Replace IAM Role."

  3. Select the IAM role you recently created, and then 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. Navigate to the RDS console and choose the instance you have recently created.

  2. Click on "Configuration" and make a note of the endpoint address.

  3. Click on "Security" and take note of the username and password.

  4. Click on "Security" and take note of the username and password.

    No alt text provided for this image

  5. Install a MySQL client, for example, "mysql".

    No alt text provided for this image

  6. Establish a connection to the RDS instance using the MySQL client with the provided endpoint address, username, and password:

     mysql -h <endpoint address> -P <port.no> -u <username> -p
    
  7. Input the password when prompted and press Enter.

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

    No alt text provided for this image

Conclusion

In conclusion, Relational Database Service in AWS is a game-changer for developers and businesses alike. It streamlines database management, allowing you to focus on innovation rather than infrastructure.

If you found this blog helpful and have any questions or want to share your experiences, feel free to connect with me on LinkedIn. Let's build a community of DevOps enthusiasts and share our knowledge for mutual growth.