AWS Three Tier Web Architecture Implementation

Subham Pradhan
9 min readNov 30, 2023

--

A Three-Tier Web Architecture typically consists of three main components: presentation tier (web server), application tier (application server), and data tier (database server). In an AWS environment, you can leverage various AWS services to implement each tier. Here’s an example of AWS services that can be used for each tier:

Presentation Tier (Web Server):

  • AWS Elastic Load Balancer (ELB): Distributes incoming apcplication traffic across multiple Amazon EC2 instances to ensure fault tolerance.
  • Amazon EC2 (Elastic Compute Cloud): Virtual servers in the cloud to run the web application. EC2 instances can host your web server.

Application Tier (Application Server):

  • Amazon EC2 (Elastic Compute Cloud): EC2 instances can also be used to host the application server.
  • AWS Elastic Beanstalk: A fully managed service that makes it easy to deploy and run applications in multiple languages.

Data Tier (Database Server):

  • Amazon RDS (Relational Database Service): Managed relational database service that supports various database engines such as MySQL, PostgreSQL, Oracle, SQL Server, etc.
  • Amazon DynamoDB: A fully managed NoSQL database service for applications that need consistent, single-digit millisecond latency.

Other Important Services:

  • Amazon S3 (Simple Storage Service): For storing static files, images, and other assets.
  • Amazon CloudFront: Content Delivery Network (CDN) service to cache and deliver static and dynamic web content.
  • AWS Route 53: Domain Name System (DNS) web service for routing end-user requests to globally distributed endpoints.

Here’s a simplified diagram of how these services might be used in a Three-Tier Web Architecture on AWS:

Access the project details, including PDF and text documents, on my GitHub: 3TierArchitectureImplementation.

Step 0: Setup

  1. Download Code from Github:
  1. S3 Bucket Creation (ACLs Disabled):
  2. Create an S3 bucket with ACLs disabled.
  1. IAM EC2 Instance Role Creation:
  2. Attach policies: AmazonSSMManagedInstanceCore, AmazonS3ReadOnlyAccess to a new IAM role for EC2 instances.
  3. Create the role.

Step 1: Networking and Security

VPC Setup:

  • Create a VPC with CIDR range 10.0.0.0/16.
  • Create Subnets :
  • Create public and private subnets in two availability zones.
  • Create an Internet Gateway and attach it to the VPC.
  • Create a NAT Gateway in the public subnet of AZ-1.
  • Create a NAT Gateway in the public subnet of AZ-2.
  • Create Route Tables and associate them with subnets.
  1. Create Security Groups:
  • Create security groups for different components based on requirements.

Step 2: Database Deployment

Database Subnet Groups and Multi-AZ:

  • Create a DB subnet group with subnets in AZ-1 and AZ-2.

Launch an Amazon Aurora MySQL database with multi-AZ configuration.

Step 3: App Tier Instance Deployment

  • Launch an EC2 instance in the private app subnet of AZ-1 with the Private-instance-sg security group.
  • Configure software stack, including MySQL setup.
  1. App Instance Configuration:

Step 4: Internal Load Balancing and Auto Scaling

App Tier AMI and Target Group: — Create an AMI for the App Tier EC2 instance. — Create a target group for the internal load balancer.

  1. Create a target group for the web tier.
  1. Internal Load Balancer and Launch Template:
  • Create an internal Application Load Balancer.
  • Create a launch template for the App Tier instances.
  1. Auto Scaling:
  • Configure Auto Scaling for the App Tier using the launch template and target group.

App Server - Connect - Open in Session Manager

Step 5: Web Tier Instance Deployment

NGINX Configuration: — Update NGINX configuration files with the internal load balancer’s DNS. — Upload configuration files to the S3 bucket.

  1. Web Instance Deployment:
  • Launch an Amazon Linux EC2 instance for the web tier in the public subnets.
  • Configure the instance with Node.js, PM2, and NGINX.
  • Deploy the web application code from the S3 bucket.

Create a target group for the web tier.

Create an external Application Load Balancer for the web tier.

Create a launch template for the web tier instances.

Auto Scaling for Web Tier:

  • Configure Auto Scaling for the web tier using the launch template and target group.

Final Verification:

  • Verify the overall setup by accessing the external load balancer’s DNS.

This breakdown provides a step-by-step guide for setting up the three-tier architecture on AWS.

--

--

Subham Pradhan

DevOps Engineer | CI/CD | K8S | Docker | Jenkins | Ansible | Git | Terraform | ArgoCD |Helm|Prometheus|Grafana|SonarQube|Trivy|Data Engineer | Azure |DevSecOps|