DEV Community

Cover image for AWS Three-Tier Architecture
Hema
Hema

Posted on

AWS Three-Tier Architecture

🚀 Deploying a Scalable Web Application on AWS

In this article, we'll walk through the complete setup and deployment of a scalable, production-ready web application on AWS. We'll cover everything from architecture, networking, EC2, database, load balancers, and auto-scaling. By the end, you'll have a fully functional, auto-scaled web application deployed on AWS.


🟣 PART 1 — Architecture & Initial Setup

✅ Architecture Overview

Architecture


✅ 1. Download Code from GitHub

Clone the GitHub repository containing the application code.

Download Code


✅ 2. Create an S3 Bucket

Navigate to S3 Service > Create Bucket.

S3 Bucket


✅ 3. IAM Role for EC2-S3 Communication

Go to IAM > Roles > Create Role.

Select EC2 and attach the following policies:

  • AmazonSSMManagedInstanceCore
  • AmazonS3ReadOnlyAccess

IAM Role


🟣 PART 2 — Networking & Security

✅ 1. VPC Creation

Go to VPC Dashboard > Your VPCs > Create VPC.

VPC Creation


✅ 2. Subnet Creation

Create 6 subnets across two Availability Zones for high availability.

Subnet Creation


✅ 3. Internet Gateway

Create and attach an Internet Gateway to the VPC for public subnet internet access.

Internet Gateway


✅ 4. NAT Gateway

Create NAT Gateways in your public subnets for private subnets to access the internet.

NAT Gateway


✅ 5. Routing Configuration

Set up route tables and associate subnets properly.

Route Table


✅ 6. Security Groups

Define security groups for EC2 and Load Balancers to control traffic.

Security Group


🟣 PART 3 — Database Deployment

✅ 1. Subnet Group for RDS

Create an RDS Subnet Group using private subnets.

Subnet Group


✅ 2. Database Creation

Create your RDS database instance.

Database Deployment


🟣 PART 4 — Application Deployment

✅ 1. Launch App Instance

Launch an EC2 instance for your App Tier.

Launch Instance


✅ 2. Connect to Instance

Use Session Manager to connect to your instance securely.

Connect to Instance


✅ 3. Configure Database Connection

Configure database credentials for the application.

Configure Database


✅ 4. Configure App Instance

Update your app-tier to use correct database and S3 details.

Configure App

Upload your app-tier code to S3.

Upload App Tier


✅ 5. Test App

Ensure the app-tier is working correctly.

Test App


🟣 PART 5 — Internal Load Balancer & Auto Scaling

✅ 1. App Tier AMI

Create an AMI from your configured App Instance.

Create AMI


✅ 2. Create Target Group

Target Group


✅ 3. Internal Load Balancer

Deploy an internal Load Balancer.

Internal Load Balancer


✅ 4. Launch Template

Create a Launch Template with the AMI.

Launch Template


✅ 5. Auto Scaling Group

Set up Auto Scaling for your App Tier.

Auto Scaling


🟣 PART 6 — Web Instance Deployment

✅ 1. Update Config File

In the nginx.conf, replace [INTERNAL-LOADBALANCER-DNS] with your internal load balancer DNS.

Update Config


✅ 2. Launch Web Instance

Launch Web Instance


✅ 3. Connect to Instance

Connect Web Instance


✅ 4. Configure Web Instance

Install necessary packages and configure the web-tier.

Configure Web


🟣 PART 7 — External Load Balancer & Auto Scaling

✅ 1. Web Tier AMI

Create an AMI from your web instance.

Web AMI


✅ 2. Target Group

Target Group


✅ 3. Internet-Facing Load Balancer

Deploy an Internet-Facing Load Balancer.

Internet Load Balancer


✅ 4. Launch Template

Launch Template


✅ 5. Auto Scaling Group

Configure Auto Scaling for the Web Tier.

Auto Scaling Web


✅ 🎉 Final Result

Congratulations! Your highly available, auto-scaled, and load-balanced Web Application is ready 🚀

Web App


💡 Feel free to drop your questions or suggestions in the comments. Happy Deploying! 🌐


Top comments (0)