Day 44: Relational Database Service in AWS (RDS)

Day 44: Relational Database Service in AWS (RDS)

ยท

3 min read

Congratulations, You learn the Access to S3 services in AWS.

What is Relational Database Service (RDS)

Amazon RDS (Relational Database Service) is a managed relational database service offered by Amazon Web Services (AWS). It simplifies the process of setting up, operating, and scaling a relational database, which is often a critical component of applications. RDS takes care of routine database tasks such as provisioning, patching, backup, recovery, and scaling, allowing developers and administrators to focus on their applications rather than the underlying database infrastructure.

Key-Features

  • RDS supports popular relational database engines such as MySQL, PostgreSQL, MariaDB, Oracle, Microsoft SQL Server, and Amazon Aurora.

  • RDS automatically takes backups of your database and allows you to restore to any point in time within the retention period.

  • RDS provides options for high availability using Multi-AZ deployments, which replicate data to a standby instance in a different Availability Zone.

  • You can easily scale your database by changing the instance type or using Amazon Aurora, which offers automatic and manual scaling.

  • RDS includes security features like encryption at rest and in transit, as well as support for a Virtual Private Cloud (VPC) to isolate your database.

  • RDS manages software patching for the database engine, keeping it up to date with the latest security and bug fixes.


TASK

Create a Free tier RDS instance of MySQL

Create an EC2 instance

Create an IAM role with RDS access

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

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

Hint:

You should install mysql client on EC2, and connect the Host and Port of RDS with this client.

Step 1: Create a Free Tier RDS Instance:

  • Log in to the AWS Management Console. Navigate to the RDS service and click on Create Database.

  • Choose Standard Create. Select the MySQL engine.

  • Choose the Free tier template.

  • Configure the database settings, including the instance identifier, master username, and master password.

  • Configure additional settings such as the DB instance size, storage, VPC, and security group.

  • Review and launch the RDS instance.

Step 2: Create an EC2 Instance:

  • Log in to the AWS Management Console. Navigate to the EC2 service.

  • Click on Launch Instances and select an Amazon Machine Image (AMI) for your EC2 instance (e.g., Amazon Linux 2).

  • Choose an instance type (e.g., t2.micro) that is within the Free Tier. Configure instance details, including the IAM role created in the next step.

  • Review and launch the EC2 instance.

Step 3: Create an IAM Role with RDS Access:

  • In the AWS Management Console, navigate to the IAM service. Create a new IAM role and select EC2 as the trusted entity.

  • Attach the policy AmazonRDSDataFullAccess to this role, which provides necessary access to RDS.

  • Name and create the role.

Step 4: Assign the Role to EC2:

  • After launching the EC2 instance, select it in the EC2 dashboard.

  • Choose Actions, then Instance Settings, and finally Attach/Replace IAM Role.

  • Select the IAM role created in step 3 and attach it to the EC2 instance.

Step 5: Connect to RDS from EC2 Using MySQL Client:

  • SSH into your EC2 instance using the private key associated with the key pair.

  • Install the MySQL client on the EC2 instance if it's not already installed.

  • Use the MySQL client to connect to the RDS instance. You'll need the RDS endpoint, username, and password obtained during RDS creation.

  • To connect use the following command:

      mysql -h <RDS_endpoint> -u <username> -p
    
  • You'll be prompted for the password you set during RDS instance creation.


That's all for today. Hope you like it. FOLLOW to join me in the journey of DevOps

ย