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.
Steps:
Launch one EC2 instance with the open 3306 port.
Go to RDS and create a new database.
- Select the free tier template.
- Add credentials to the database.
- Add EC2 server in connectivity.
- Select default VPC group.
- Create database.
- The database is created.
- Now we need to add RDS roles to our EC2 instance. Go to IAM and create a new role.
- Add AmazonRDSFullAccess permission.
- Go to EC2 instance Actions > Security > Modify IAM role.
- Add the role, which we have created with RDS access.
- Go to the database once it's created and copy the endpoint.
SSH to EC2 instance and install mysql-client using the below command.
Login to MySQL using the endpoint that we copied from the RDS console.
sudo apt update
sudo apt install mysql-client
mysql -h <endpoint-name> -P <port-name> -u <username> -p
- Run a few commands like
show databases;
to check if everything is working fine.
Thank you :)