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
1. Create an EC2 instance
Go to the Amazon EC2 console.
Click "Launch Instance". Choose a Linux AMI.
Choose an instance type, such as t2.micro. Choose a VPC and subnet.
Configure security group rules to allow inbound traffic on the appropriate port for the type of database you are using (e.g. port 3306 for MySQL).
Launch the instance.
2. Create a Free tier RDS instance of MySQL
Go to the Amazon RDS console. Click "Create database".
Select "MySQL" as the engine type.
Choose the "Free tier" template for "DB instance class".
Enter a unique name for the "DB instance identifier".
Set the "Master username" and "Master password" for the database.
Set the "Virtual Private Cloud (VPC)" and "Subnet group" to create the instance in.
Leave the other settings at their default values.
Select ec2-instance
Choose VPC security group
Click "Create database" to start the instance creation.
Database is created.
3. Create an IAM role with RDS access.
Go to the IAM console. Click "Roles". Click "Create role".
Choose the 'AWS service'.
Choose "Allows EC2 instances to call AWS services on your behalf".
Attach the "AmazonRDSFullAccess" policy.
Enter a unique name for the role.
Click "Create role".
Role is created
4. Assign the role to EC2 so that your EC2 Instance can connect with RDS
Go to the EC2 console.
Select the instance you just created.
Click "Actions", then "Security", then "Modify IAM Role".
Choose the IAM role you just created.
Click "Update IAM role".
5. Once the RDS instance is up and running, get the credentials and connect your EC2 instance using a MySQL client.
Go to the RDS console.
Select the instance you just created.
Click "Configuration" and note the endpoint address.
Click "Security" and note the username and password.
SSH into your EC2 instance using a terminal or remote access tool.
Install a MySQL client, such as "mysql".
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.
Thank you for reading!! I hope you find this article helpful!!
Happy Learning!!
Sayali✨