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
Go to the AWS Management Console, sign in, and go to the Amazon RDS service.
Click on "Create database" and choose "MySQL".
Select the "Free tier" template to ensure you are within the free tier limits.
Set up a "master username" and "master password"
Then, click on "Create database"
The database is created
Create an EC2 instance
Go to the EC2 service in the AWS Management Console.
Click on "Instances" and then "Launch Instance".
Choose an Amazon Machine Image (AMI)
Select an instance type
Configure the instance
Launch the instance.
Create an IAM role with RDS access
Go to the IAM service in the AWS Management Console.
Click on "Roles" and then "Create role".
Choose "AWS service" as the trusted entity type, select EC2 as the use case, and click "Next".
Attach the policy AmazonRDSFullAccess
Provide a name for the role.
Then click "Create role".
Assign the role to EC2 so that your EC2 Instance can connect with RDS.
Go back to the EC2 instance.
Select the EC2 instance
Under the "Actions" dropdown, go to "Security", and then "Modify IAM Role".
Attach the IAM role you created to the EC2 instance and click "Update IAM role"
Connect your EC2 Instance with the RDS database
Once the RDS instance is up and running, get the credentials and connect your EC2 instance using a MySQL client.
Select your RDS instance, and in the "Connectivity & security" tab, note the endpoint.
SSH into your EC2 instance and install mysql-client:
sudo apt update
sudo apt install mysql-client
Now, to connect to the RDS instance using the MySQL client, we will use the command below:
mysql -h <endpoint-name> -P <port-name> -u <username> -p
Enter the password when prompted (the password we used when creating our MySQL database.)
We are now connected to our RDS instance from our EC2 instance using MySQL client.
Thank you...