Relational Database Service in AWS.

Relational Database Service in AWS.

·

3 min read

Table of contents

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

  • 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.

Firstly, initiate the setup of a standard EC2 instance with default configurations, and configure the security group rules to permit inbound traffic on the relevant port for your specific database (e.g., port 3306 for MySQL).

Proceed to launch the EC2 instance.

Next, establish a Free tier RDS instance for MySQL.

Navigate to the Amazon RDS console and click on "Create database."

Opt for "MySQL" as the engine type.

Select the "Free tier" template under "DB instance class."

Assign a distinctive name to the "DB instance identifier."

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

Configure the "Virtual Private Cloud (VPC)" and "Subnet group" where the instance will be created.

Choose the EC2 instance and set the VPC security group.

Maintain the default values for other settings.

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

Once the database is successfully created, you're ready to proceed.

Now,
Begin by establishing an IAM role with RDS access.

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

Opt for 'AWS service.'

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

Attach the "AmazonRDSFullAccess" policy.

Provide a distinctive name for the role.

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

Once the role is created, assign it to the EC2 instance to enable connectivity with RDS.

Head to the EC2 console.

Select the recently created instance.

Click "Actions," followed by "Instance Settings," and then "Attach/Replace IAM Role."

Select the IAM role created earlier.

Click "Update IAM role."

After ensuring that the RDS instance is up and operational, retrieve the credentials and establish a connection between your EC2 instance and RDS using a MySQL client.

Access the RDS console.

Select the newly created instance.

Click "Configuration" to note the endpoint address.

Navigate to "Security" to record the username and password.

Subsequently, use a terminal or remote access tool to SSH into your EC2 instance.

Install a MySQL client, such as "mysql".

sudo apt-get update
sudo apt install mysql-client-core-8.0

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

Enter the password when prompted and press enter.

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

Thankyou for reading until here. See you in the next one where there will be deployment of wordpress website on the AWS.