AWS Builder Center
Build a Highly Available Web Application on AWS – End-to-End Hands-On Project

Build a Highly Available Web Application on AWS – End-to-End Hands-On Project

A practical, end-to-end AWS project demonstrating how to build a highly available and scalable web application using VPC, EC2, Application Load Balancer, Auto Scaling, Amazon RDS, S3, and CloudWatch. Includes architecture, hands-on implementation, testing, monitoring, troubleshooting, and cost optimization.

Build a Highly Available Web Application on AWS – End-to-End Hands-On Project
1. Introduction
What happens when your web server suddenly goes down while users are accessing your application?
In a production environment, a single server failure should not bring down the entire application.
This is where High Availability, Load Balancing, Auto Scaling, and Monitoring become important.
In this hands-on project, we will explore how to design and build a highly available web application using AWS core services.
The goal is not just to understand AWS services individually, but to understand how they work together in a real-world cloud infrastructure.
2. Project Architecture
Our architecture will use the following AWS services:
  • Amazon VPC – Isolated cloud network.
  • Public and Private Subnets – Network segmentation across two Availability Zones.
  • Amazon EC2 – Hosts the web application.
  • Application Load Balancer (ALB) – Distributes incoming traffic.
  • Auto Scaling Group – Maintains the desired EC2 capacity.
  • Amazon RDS – Managed relational database.
  • Amazon S3 – Stores static application assets.
  • Amazon CloudWatch – Monitors infrastructure and generates alarms.
  • AWS IAM – Controls access to AWS resources.
Traffic flow:
User → Application Load Balancer → EC2 Instances → RDS Database
Static assets are stored in S3, while CloudWatch monitors the infrastructure.
3. Lab Prerequisites
Before starting, prepare:
  • An AWS account with billing alerts enabled.
  • Basic understanding of Linux commands.
  • Basic networking knowledge (VPC, subnet, route table).
  • Familiarity with EC2 and security groups.
  • An SSH client or AWS Systems Manager access.
Important: AWS services such as ALB, NAT Gateway, Multi-AZ RDS, and EC2 can incur charges. Check current pricing before deploying. This is not guaranteed to be a zero-cost lab.
4. Step-by-Step Implementation
Step 1: Create a VPC
Create a custom VPC with CIDR:
10.0.0.0/16
Create four subnets:
  • Public Subnet – AZ A: 10.0.1.0/24
  • Public Subnet – AZ B: 10.0.2.0/24
  • Private Subnet – AZ A: 10.0.3.0/24
  • Private Subnet – AZ B: 10.0.4.0/24
Configure appropriate route tables and internet connectivity. Keep application and database resources in private subnets wherever possible.
Step 2: Launch EC2 Instances
Create an EC2 Launch Template using Amazon Linux.
Install Nginx using this user-data script:
#!/bin/bash
dnf update -y
dnf install nginx -y
systemctl enable nginx
systemctl start nginx
cat > /usr/share/nginx/html/index.html <<'EOF'
<h1>My AWS Web Application</h1>
<p>High Availability Lab</p>
<p>Deployed using Amazon EC2</p>
EOF
Configure the instance security group to allow HTTP traffic only from the ALB security group.
Step 3: Configure Application Load Balancer
Create an Application Load Balancer across both public subnets.
Configure:
  • Listener: HTTP 80 for the initial lab.
  • Target Group: EC2 instances.
  • Health Check Path: /
  • Target Port: 80.
For production, use HTTPS with an ACM certificate and secure redirect rules.
Step 4: Configure Auto Scaling
Create an Auto Scaling Group using your Launch Template.
Configure:
  • Minimum Capacity: 2
  • Desired Capacity: 2
  • Maximum Capacity: 4
  • Availability Zones: 2
Attach the Target Group to the Auto Scaling Group.
This allows EC2 capacity to adjust based on configured scaling policies and helps maintain availability during instance failures.
Step 5: Configure Amazon RDS
Create an Amazon RDS MySQL database.
For the production-style architecture:
  • Use a DB subnet group spanning two private subnets.
  • Enable Multi-AZ deployment where appropriate.
  • Disable public accessibility.
  • Allow database access only from the application security group.
  • Store database credentials securely.
Do not expose database credentials in application code or public repositories.
Step 6: Configure Amazon S3
Create an S3 bucket for static assets.
Upload sample files such as:
  • Images
  • CSS files
  • JavaScript files
Keep Block Public Access enabled unless a specific, reviewed access design requires otherwise.
Step 7: Configure CloudWatch Monitoring
Create CloudWatch monitoring and alarms for:
  • EC2 CPU utilization.
  • ALB request count.
  • ALB HTTP 5xx errors.
  • Target health.
  • Auto Scaling activity.
Configure notifications through Amazon SNS.
For memory and disk metrics, install and configure the CloudWatch Agent on EC2 instances. These metrics are not automatically included in standard EC2 monitoring.
5. Testing and Validation
A cloud project is incomplete without testing.
Perform these practical tests:
Test 1 – Application Availability
Access the ALB DNS endpoint in your browser. Verify that the application loads.
Test 2 – Load Balancing
Send multiple requests and inspect the target group and application responses.
Test 3 – Instance Failure
Terminate one test EC2 instance through a controlled lab exercise.
Observe whether the Auto Scaling Group launches a replacement and whether healthy targets continue serving traffic.
Test 4 – Monitoring
Check CloudWatch metrics and trigger a controlled alarm condition.
Test 5 – Database Connectivity
Verify that the application can communicate with RDS through the permitted security group rules.
Record screenshots and actual test results.
6. Security Best Practices
  • Follow the principle of least privilege with IAM.
  • Keep database instances private.
  • Restrict SSH access or prefer Systems Manager Session Manager.
  • Use HTTPS for production traffic.
  • Store secrets in AWS Secrets Manager or Parameter Store.
  • Enable appropriate S3 security controls.
  • Review security groups regularly.
7. Cost Optimization
High availability is valuable, but it comes with additional infrastructure costs.
Consider:
  • Using smaller instance types for learning.
  • Avoiding unnecessary NAT Gateways.
  • Reviewing RDS Multi-AZ costs.
  • Deleting unused load balancers and databases.
  • Monitoring usage through AWS Cost Explorer.
  • Setting AWS Budgets and billing alerts.
Deploy expensive components only when needed for the relevant lab stage.
8. What I Want to Learn From This Project
My objective is to develop practical cloud infrastructure skills beyond theoretical AWS knowledge.
This project brings together networking, Linux administration, compute, storage, databases, security, monitoring, and troubleshooting.
It also helps demonstrate how individual AWS services work together to support a scalable application.
9. Community Discussion
I would love to learn from engineers who have designed production workloads on AWS.
Here are three questions:
  1. Would you choose EC2 Auto Scaling or Amazon ECS for this application, and why?
  1. What additional security controls would you implement before making this architecture production-ready?
  1. How would you reduce infrastructure costs without compromising availability?
Have you built a similar AWS architecture? What would you improve or change?
Share your experience and suggestions in the comments. I would especially appreciate practical feedback from AWS and Cloud Engineers.
#AWS #CloudComputing #HandsOnLab #CloudArchitecture
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article