Skip to content

Latest commit

Β 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Terraform AWS 3-Tier Platform

AWS 3-Tier Platform Banner

Terraform β€’ AWS β€’ Docker β€’ EC2 β€’ VPC β€’ Infrastructure as Code


πŸ“Œ Project Overview

This project demonstrates how to build a modular AWS infrastructure using Terraform and Infrastructure as Code (IaC) principles.

The platform provisions:

  • AWS VPC
  • Public and Private Subnets
  • Internet Gateway
  • Route Tables
  • Security Groups
  • Frontend EC2 Instance
  • Backend EC2 Instance
  • Dockerized Application Stack
  • Reusable Terraform Modules

The goal of this project is to showcase cloud infrastructure design, Terraform best practices, modular architecture, and AWS networking fundamentals.


πŸ—οΈ Architecture Diagram

Architecture Diagram

Architecture Flow

Internet
    β”‚
Internet Gateway
    β”‚
VPC (10.0.0.0/16)
β”‚
β”œβ”€β”€ Public Subnet (10.0.1.0/24)
β”‚     └── Frontend EC2
β”‚            └── Dockerized Nginx
β”‚            └── Port 8080
β”‚
└── Private Subnet (10.0.11.0/24)
      └── Backend EC2
             └── Dockerized API
             └── Port 3000

βš™οΈ Technology Stack

Technology Purpose
Terraform Infrastructure as Code
AWS EC2 Compute Resources
AWS VPC Networking
Security Groups Access Control
Docker Containerization
Nginx Frontend Web Server
Ubuntu Linux Operating System

πŸ“‚ Repository Structure

terraform-aws-3tier-platform/
β”œβ”€β”€ diagrams/
β”‚   β”œβ”€β”€ terraform-aws-3tier-platform.drawio
β”‚   β”œβ”€β”€ terraform-aws-3tier-platform.png
β”‚   └── terraform-aws-3tier-platform.svg
β”‚
β”œβ”€β”€ modules/
β”‚   β”œβ”€β”€ ec2/
β”‚   β”œβ”€β”€ security-groups/
β”‚   └── vpc/
β”‚
β”œβ”€β”€ screenshots/
β”‚
β”œβ”€β”€ main.tf
β”œβ”€β”€ provider.tf
β”œβ”€β”€ variables.tf
β”œβ”€β”€ outputs.tf
β”œβ”€β”€ versions.tf
└── README.md

🧩 Terraform Modules

VPC Module

Responsible for:

  • VPC Creation
  • Public Subnet
  • Private Subnet
  • Internet Gateway
  • Route Tables

Security Groups Module

Responsible for:

  • Frontend Security Group
  • Backend Security Group
  • Access Rules

EC2 Module

Responsible for:

  • Frontend EC2 Instance
  • Backend EC2 Instance
  • Instance Networking

πŸš€ Deployment

Initialize Terraform

terraform init

Validate Configuration

terraform validate

Create Execution Plan

terraform plan

Deploy Infrastructure

terraform apply

Destroy Infrastructure

terraform destroy

πŸ“Š Deployment Proof

Terraform Apply

Terraform Apply

AWS Resources

AWS Resources

Security Groups

Security Groups

Frontend Application

Frontend

Backend API

Backend


πŸ” Security Design

Implemented security controls:

  • SSH Access via Key Pair Authentication
  • Frontend Service exposed on Port 8080
  • Backend Service restricted to internal communication
  • Security Group based traffic control
  • Infrastructure resources isolated within custom VPC

πŸ“€ Terraform Outputs

The project exposes useful deployment information:

  • VPC ID
  • Public Subnet ID
  • Private Subnet ID
  • Frontend Public IP
  • Frontend Private IP
  • Backend Private IP

View outputs:

terraform output

πŸ“š Complete Project Walkthrough

Read the full technical article:

🌐 Website Article

https://devriston.com.pk/blog/terraform-aws-3tier-platform.html

πŸ“ Dev.to

https://dev.to/muhammadkamrankabeeross


πŸ“– Additional Documentation

Interview preparation notes:

docs/interview-guide.md

🧠 Future Improvements

  • Application Load Balancer (ALB)
  • Auto Scaling Groups (ASG)
  • S3 Remote Backend
  • DynamoDB State Locking
  • GitHub Actions CI/CD
  • AWS CloudWatch Monitoring
  • RDS Database Tier
  • Multi-Environment Deployment

πŸ‘¨β€πŸ’» Author

Muhammad Kamran Kabeer

DevOps Engineer focused on Cloud Infrastructure, Linux, Terraform, AWS, Automation, and Infrastructure as Code.

🌐 Website: https://devriston.com.pk

πŸ“ Dev.to: https://dev.to/muhammadkamrankabeeross

πŸ™ GitHub: https://github.com/muhammadkamrankabeer-oss


⭐ Support

If you found this project useful, consider giving it a star ⭐.

About

Production-style AWS 3-tier infrastructure using Terraform, Docker, EC2, VPC, and modular Infrastructure as Code practices.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages