Day 44: Relational Database Service in AWS
Welcome to another exciting day of exploring AWS services. Today, we'll delve into the process of seamlessly integrating an RDS instance with an EC2 instance in AWS.
In this blog post, we'll walk through each step, from creating a Free Tier RDS instance of MySQL to connecting an EC2 instance using a MySQL client. Let's get started
Task-01: Integrating RDS and EC2 Instances
Step 1: Create a Free Tier RDS Instance of MySQL
To begin, let's set up an RDS instance of MySQL using the AWS Management Console. Here's how you can do it:
Log in to the AWS Management Console.
Navigate to the RDS service.

Click on "Create database" to start the instance creation wizard.

Choose "MySQL" as the database engine and select the version that suits your requirements. we will be using PostgreSQL

Configure the instance details, including instance specifications, storage options, and database settings.
Set up the master username and password for your MySQL database.

Configure the networking options and security groups.


Review your settings and Create the RDS instance.

Step 2: Create an EC2 Instance
I hope till now you have mastered in creating instance of EC2

Step 3: Create an IAM Role with RDS Access
1. Navigate to the IAM service in the AWS Management Console.
2.Click on "Roles" and then "Create role".
Choose the EC2 service as the trusted entity.

Attach the appropriate policies that grant RDS access to the role.

Review your settings and create the IAM role.

Step 4: Assign the IAM Role to the EC2 Instance
Go to the EC2 dashboard in the AWS Management Console.
Select the EC2 instance you created in Step 2.
Click on "Actions" and then "Security".

Choose "Modify IAM role" and select the IAM role created in Step 3.

update IAM role
Step 5: Connect the EC2 Instance to the RDS Database Using a MySQL Client
Retrieve the credentials for your RDS instance from the RDS dashboard.
SSH into your EC2 instance using a terminal or SSH client.
Install a MySQL client on your EC2 instance.

Use the MySQL client and the RDS credentials to connect to the RDS instance.

That's it! You have successfully connected your RDS and EC2 instances. Now you can leverage the power of this integration for your applications and databases.
If you have any queries/suggestions please write a comment below. See you another day with another challenge.



