Day 44: Relational Database Service in AWS
Dear Learners, In Today's article we will explain Amazon Relational Database Service (Amazon RDS) that how RDS work,definitions & Tasks. So now let's start without wasting the time.
RDS:-
Amazon Relational Database Service (Amazon RDS) is a collection of managed services that makes it simple to set up and scale database in the cloud.
I will Explain with the help of Tasks:
Prerequisites:-
Task-01
Login to your Amazon Account with username and Passoword.
Go to the Amazon EC2 console.
Click on "Launch Instance" on the right side of page. Highlight in orange colour.
Choose a "Linux AMI", give a name to your Ec2 instance.
Choose an instance type according to your need, I have select the t2.micro.
Configure the Security group rules to allow inbound traffic on the Appropriate port for the type of database you are using (e.g port 3306 used for the MySQL).
Launch the instance.
2 Create a Free tier RDS instance of MYSQL.
Go to the Amazon RDS console. Click on "Create Database option" highlight in orange colour.
In the Database creation method choose the Standard Create.
In Engine option:- I will select the MySQL, you can select according to your need like:- MariaDB, Oracle & PostgreSQL etc.
Choose the "Free tier" template for "DB instance class" no charges for the "free tier"
Next Step:- Enter a unique name for the "DB instance identifier".
Set the "Master username" & "Master Password" for the database, It will used while login the database from the terminal, I will explain in it in Today Task.
Set the "Virtual Private Cloud" and "Subnet group" to create the instance in.
Leave the other settings at their default values.
Select EC2 instance.
Choose VPC Security Group:-
Click on the "Create database" to start the instance creation.
Database is created.
After completing the Point 1 & Point 2, Move forward to Point to no 3:-
3. Create an IAM role for with RDS access.
Go to the IAM console in AWS. Click on "Roles". click on "Create Role" show in blue colour right side.
Choose the "AWS Service"
Choose "Allows Ec2 instance to call AWS Services on your behalf".
Need to be attached the "AmazonRDSFullAccess" policy.
Recommended by LinkedIn
Enter a Unique name for the role.
Click on "Create role"
IAM Role is Successfully created, I will highlight in Blu Tick.
Point No 4 is very Important:-
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 on "Actions" option then "Instance Settings", then "Attach/Replace IAM Role".
Choose the IAM role you just created.
Click on the "Updated 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 RDS console in AWS.
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.
Need to be install the MySQL Client, such as "mysql".I will share the commands it will helpful for you for the installtion.
Syntax:-
sudo apt install mysql-client-core-8.0
mysql --version
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 prompter and press enter:-
you should now be connected to the MySQL database on the RDS instance.
Syntax:-
sudo mysql -h database-1.c4mwnlabtvwh.ap-south-1.rds.amazonaws.com -P 3306 -u admin -p
Enter the Password:- <>
you are enter in the mysql:-
mysql>
show databases;
(Note) if your RDS are not access please check the Endpoint address in RDS. It will take one or 2 min for access.
In this blog, I have discussed RDS Definition, create a database,attach with the IAM Role . If you have any questions or would like to share your experiences, feel free to leave a comment below. Don't forget to read my blogs and connect with me on LinkedIn and let's have a conversation.
Thank you for reading !! I hope you find this article helpful!!
Happy Learning!!
Next Topic:
Day 45: Deploy Wordpress Website on AWS
Cloud computing | AWS | GCP | Azure | DevOps | 30k+ LinkedIn |Kubernetes | Docker| Terraform | Jenkins | 5 million+ impressions
1yWell written