Skip to content

🌐 Modular Terraform project that provisions a two-tier AWS architecture (VPC, public & private subnets, NAT, EC2 web + DB, Apache bootstrap). Designed with best practices for Infrastructure as Code (IaC) β€” reusable modules, variables, and outputs. Perfect for DevOps & Cloud interview prep.

Notifications You must be signed in to change notification settings

Siyona-Patole/Terraform-Modular-Infrastructure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Terraform AWS VPC + EC2 (Apache) β€” Modular Infrastructure πŸš€

Terraform
AWS
IaC
Region


πŸ“– Overview

This project provisions a 2-tier AWS architecture using Terraform modules.
It demonstrates how to design Infrastructure as Code (IaC) with best practices: reusable modules, variables, outputs, and bootstrap automation.

The setup creates:

  • Networking (VPC + subnets + routing)
  • Security (web & db security groups)
  • Compute (EC2 instances for web & db)
  • Bootstrap (Apache web server auto-configured via user_data)

πŸ“Š Architecture

  • VPC (10.0.0.0/16) – isolated network
  • Public Subnet (10.0.1.0/24) – hosts Apache web server
  • Private Subnet (10.0.2.0/24) – hosts DB instance (no public IP)
  • Internet Gateway (IGW) – internet access for public subnet
  • NAT Gateway (optional) – outbound internet for private subnet
  • Security Groups –
    • Web SG β†’ HTTP (80), SSH (22)
  • EC2 Instances –
    • Web (public subnet) β†’ Apache auto-installed via user-data.sh
    • DB (private subnet) β†’ no public IP, backend-only

🧱 Project Structure

terraform-vpc-ec2-apache-modular/
β”œβ”€β”€ main.tf                 # Root module wiring (calls submodules)
β”œβ”€β”€ versions.tf             # Terraform + provider requirements
β”œβ”€β”€ provider.tf             # AWS provider
β”œβ”€β”€ variables.tf            # Input variables
β”œβ”€β”€ outputs.tf              # Output values
β”œβ”€β”€ user-data.sh            # Bootstrap script (Apache install + HTML)
β”œβ”€β”€ .gitignore
β”œβ”€β”€ README.md
β”‚
β”œβ”€β”€ modules/                # Reusable modules
   β”œβ”€β”€ vpc/                # VPC, subnets, IGW, NAT, routes
   β”œβ”€β”€ security/           # Web + DB security groups
   └── ec2/                # Web + DB EC2 instances

About

🌐 Modular Terraform project that provisions a two-tier AWS architecture (VPC, public & private subnets, NAT, EC2 web + DB, Apache bootstrap). Designed with best practices for Infrastructure as Code (IaC) β€” reusable modules, variables, and outputs. Perfect for DevOps & Cloud interview prep.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •