Skip to main content

Command Palette

Search for a command to run...

AWS Day 35: Deploying and Managing Applications on AWS with Amazon RDS & EC2 | KodeKloud 100 Days of Cloud

Updated
5 min readView as Markdown
AWS Day 35: Deploying and Managing Applications on AWS with Amazon RDS & EC2 | KodeKloud 100 Days of Cloud
A

"I'm a 3rd-year Computer Engineering student at Marwadi University with skills in C++, web development (MERN stack), and DevOps tools like Kubernetes. I contribute to open-source projects and share tech knowledge on GitHub and LinkedIn. I'm learning cloud technologies and app deployment. As an Internshala Student Partner, I help others find jobs and courses." now currently focusing on #90DaysOfDevops

Introduction

On Day 35 of the KodeKloud 100 Days of Cloud Challenge, I worked on a complete application deployment scenario involving Amazon RDS and Amazon EC2.

The objective wasn't just to create a database—it was to deploy a secure backend infrastructure where an application running on an EC2 instance could communicate with a private MySQL database hosted on Amazon RDS.

This lab closely resembles a real-world production workflow followed by DevOps engineers. It involved database provisioning, security group configuration, SSH key management, application deployment, and verifying end-to-end connectivity between the web server and the database.

Why Use Amazon RDS with EC2?

Instead of installing MySQL directly on an EC2 instance, AWS recommends using Amazon RDS, a fully managed database service.

Some of the key benefits include:

  • Automated backups

  • High availability options

  • Automatic software patching

  • Storage scaling

  • Simplified database management

  • Better security through VPC integration

Keeping the database private while allowing only application servers to access it is also a common security best practice.

Lab Objective

The objective of this lab was to:

  • Create a private RDS instance named datacenter-rds

  • Use MySQL 8.4.5

  • Deploy a db.t3.micro instance

  • Configure storage using General Purpose SSD (gp2) with 5 GiB

  • Create a database named datacenter_db

  • Allow the existing EC2 instance to access the database

  • Configure password-less SSH authentication

  • Deploy a PHP application on EC2

  • Verify database connectivity through the web browser

Step 1: Create the Amazon RDS Instance

I started by navigating to the Amazon RDS Console and selected Create Database → Full Configuration.

The database was configured with the following settings:

Setting Value
Database Name datacenter-rds
Engine MySQL
Version 8.4.5
Instance Type db.t3.micro
Storage Type General Purpose SSD (gp2)
Storage Size 5 GiB
Master Username datacenter_admin

After entering the required credentials and database name, I left the remaining settings at their default values and launched the database.

Step 2: Wait Until the Database Becomes Available

Provisioning an RDS instance usually takes several minutes.

Before moving forward, I waited until the database status changed to:

Available

Only after the instance became available could it accept client connections.

Step 3: Configure Security Groups

Next, I updated the EC2 security group to allow the required traffic.

The following inbound rules were configured:

Port Purpose
3306 MySQL Database Access
80 HTTP Web Access

This allowed the application server to communicate with the RDS instance while also making the web application accessible through a browser.

Step 4: Generate an SSH Key Pair

To enable password-less SSH access, I generated a new SSH key pair on the aws-client host.

cd /root/.ssh

ssh-keygen

The command created:

id_rsa
id_rsa.pub

These files contain the private and public SSH keys used for secure authentication.

Step 5: Configure Password-less SSH Access

After generating the key pair, I copied the public key into the authorized_keys file of the EC2 instance.

This allowed the aws-client machine to connect to the server without entering a password every time, making future deployments much easier.

This is a common practice in DevOps automation and remote server management.

Step 6: Deploy the PHP Application

A PHP file named index.php was already available on the aws-client machine.

I copied it to the Apache web root directory on the EC2 instance using SCP.

scp index.php root@<EC2_PUBLIC_IP>:/var/www/html/

The file was successfully transferred to the web server.

Step 7: Update the Database Configuration

Inside index.php, I updated the database connection details.

The configuration included:

  • Database Name

  • Database Username

  • Database Password

  • RDS Endpoint

After saving the changes, the PHP application was ready to communicate with Amazon RDS.

Step 8: Verify the Application

Finally, I opened the EC2 instance's public IP address in a web browser.

The application displayed:

Connected successfully

This confirmed that:

  • The EC2 instance could reach the private RDS instance.

  • The security group configuration was correct.

  • The database credentials were valid.

  • The PHP application was successfully communicating with MySQL.

Conclusion

Day 35 was one of the most practical labs in the challenge, combining database provisioning, networking, Linux administration, and application deployment into a single workflow.

By creating a private Amazon RDS instance, configuring secure connectivity, deploying a PHP application on EC2, and successfully validating the database connection, I gained a deeper understanding of how application and database tiers interact in AWS.

This hands-on exercise closely mirrors real-world DevOps responsibilities and reinforced the importance of secure architecture, proper networking, and automated server management.

100 Days Of Cloud (AWS)

Part 1 of 29

This series documents my 100 Days of Cloud journey with AWS using KodeKloud. Each blog covers one daily task with hands-on practice, simple explanations, and real learning for beginners and cloud aspirants.

Up next

AWS Day 34: Create an AWS Lambda Function Using AWS CLI | KodeKloud 100 Days of Cloud

Introduction After creating a Lambda function using the AWS Management Console in the previous lab, Day 34 focused on deploying the same serverless application using the AWS Command Line Interface (AW

More from this blog

A

Anand Raval

131 posts

I'm Anand Raval, a Cloud & DevOps Engineer with AWS Solutions Architect Associate (SAA-C03), Certified Kubernetes Administrator (CKA), and Azure Fundamentals (AZ-900) certifications. This blog covers AWS, Kubernetes, Terraform, CI/CD, cloud architecture, automation, cost optimization, troubleshooting guides, and hands-on DevOps projects.