Day 44- 90DaysOfDevOps
Hey Learners! Welcome back. In this challenge, we'll learn the concept of a Relational database in the cloud. Let's start...
Amazon Relational Database Service (RDS):-
It is a collection of managed services that makes it simple to set up, operate, and scale databases in the cloud. Amazon RDS provides cost-efficient and scalable relational database capacity while automating time-consuming administration tasks such as hardware provisioning, database setup, patching and backups. It frees you to focus on your applications so you can give them the fast performance, high availability, security and compatibility they need.
Task 1-
Create a Free tier RDS instance of MySQL
Sign in to the AWS console and search for RDS service. On the Dashboard click Create database.
Choose a database creation method as Standard create and select MySQL as the Engine Option.
Choose the Free tier in the Templates section. Enter the unique name for the database and enter the username and password for Master.
Scroll down to the Connectivity section select Connect to EC2 compute resource and select the instance you want to connect to the database. You can create new instance also.
Choose the SG as you per your need (Make sure you add a 3306 port in the selected SG) and select Create database. Wait to finish.
Create an IAM role with RDS access
To connect with the database we need to create an IAM role with RDS access.
Search for IAM and select Roles. Create role. AWS service as a Trusted entity type and EC2 as a Use case. Click Next.
Search RDS and select AmazonRDSDataFullAccess to add permissions.
Enter the Role name and click Create role.
Assign the role to EC2 so that your EC2 Instance can connect with RDS
Select the instance you selected for the database. Click Actions --> Security --> Modify IAM Role
Click Update IAM role to update.
Once the RDS instance is up and running, get the credentials and connect your EC2 instance using a MySQL client
First, connect to your EC2 instance via SSH and install MySQL Client on it using sudo apt install mysql-client-core-8.0
command.
To connect with RDS use mysql -h <Endpoint-address> -P <Port-No> -u <username> -p
command. Here Endpoint-address you can find it by selecting the database created and going to the Connectivity and Security section. For Username and Password click on Configuration Section.
Use the above command to connect to MySQL
We have successfully connected to our MySQL database.
Thank you so much for taking the time to read till the end! Hope you found this blog informative.
Feel free to explore more of my content, and don't hesitate to reach out if need any assistance from me or in case of you have any questions.
Find me on:- Hashnode LinkedIn Github
Happy Learning!
Subscribe to my newsletter
Read articles from Amit Pawar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by