Relational Database Service in AWS

ยท

3 min read

Relational Database Service in AWS

What is Amazon RDS?

Amazon Relational Database Service (Amazon RDS) allows you to set up, operate, and scale a relational database in the AWS Cloud. It manages the database instances while you focus on your applications.

Task 1: Setting Up RDS and EC2 Connectivity with MySQL

Step 1: Create a Free Tier RDS Instance of MySQL

  1. Log in to your AWS Console: Go to AWS Management Console and sign in to your AWS account.

  2. Open RDS Console: In the AWS Management Console, navigate to the RDS service.

  3. Launch a DB Instance:

    • Click on "Create database."

    • Choose "Standard Create."

    • Select the MySQL database engine.

  • In the "Templates" select "Free tier"

  • In "Settings" give a unique name to your database and either give a Password or Auto-generate it.

  • Keep "Instance Configuration" and "Storage" settings as default.

  • Now, in "Connectivity" choose "Connect to an EC2 compute resource" and click on "Create EC2 instance" if it's not created.

  • After creating the EC2 instance, 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).

  • Choose the VPC that you have created already while spinning EC2 instance.

  • Use Password authentication to access the database and click on "Create database"

Step 2: Create an IAM Role with RDS Access

  1. Open IAM Console: In the AWS Management Console, navigate to the IAM service.

  2. Create a New Role:

    • Choose "Roles" from the left menu.

  • Click "Create role."

  • Select the use case "EC2" and click "Next: Permissions."

  1. Attach Policy:

    • Search for and attach the policy "AmazonRDSFullAccess" to grant RDS access.

  1. Review:

    • Review the role details and provide a meaningful name.

  • Click "Create role."

  • Role is Created Successfully.

Step 3: Assign the Role to EC2

  1. Open EC2 Console: In the AWS Management Console, navigate to the EC2 service.

  2. Select Your EC2 Instance:

  3. Actions > Security > Modify IAM role:

    • Attach the IAM role you created and click on update IAM role.

Step 4: Connect EC2 to RDS

  1. SSH into EC2: Use SSH to connect to your EC2 instance.

  2. Install MySQL Client: If not already installed, install the MySQL client on your EC2 instance:

sudo apt-get update
sudo apt-get install mysql-client
  • check whether MySQL is installed or not by running the below command.
mysql --version

  • Once the MySQL client is installed, you can connect to the RDS instance using the following command:
mysql -h <RDS endpoint> -P <port> -u <username> -p

"Thank you for enjoying my DevOps blog! Your positive response fuels my passion to dive deeper into technology and innovation.

Stay tuned for more captivating DevOps articles, where we'll explore this dynamic field together. Follow me on Hashnode and connect on LinkedIn (https://www.linkedin.com/in/som-shanker-pandey/) for the latest updates and discussions.

Did you find this article valuable?

Support Som Pandey's blog by becoming a sponsor. Any amount is appreciated!

ย