Skip to content

This project provisions a custom Virtual Private Cloud (VPC) on AWS using Terraform. It includes subnets, an Internet Gateway, route tables, security groups, EC2 instances with user data, and an Application Load Balancer. The setup demonstrates how to create a secure, scalable network architecture following AWS best practices.

deepak5-ux/terraform-vpc-setup

Repository files navigation

VPC Setup with Terraform

📌 Project Overview

This project provisions a custom VPC environment on AWS using Terraform. The setup includes subnets, an Internet Gateway, route tables, security groups, and EC2 instances deployed across multiple availability zones. Additionally, an Application Load Balancer (ALB) is configured to distribute traffic between instances.


🎯 Objectives

  • Deploy a custom AWS VPC infrastructure using Terraform.
  • Create public and private subnets across multiple Availability Zones.
  • Configure Internet Gateway and Route Tables for internet access.
  • Implement Security Groups with restricted inbound rules for SSH, HTTP, and HTTPS.
  • Launch EC2 instances in different subnets.
  • Set up an Application Load Balancer to handle web traffic.

🛠 Architecture Diagram

Architecture Diagram


📂 Project Structure

├── main.tf             # Main Terraform configuration
|__ provider.tf         # Provider definition
|
├── variables.tf        # Variables definition
├── outputs.tf          # Output values
├── userdata1.sh        # User data script for EC2 in subnet 1
├── userdata2.sh        # User data script for EC2 in subnet 2
├── terraform.tfvars    # Variable values
└── README.md           # Project documentation

⚙️ Prerequisites

  • AWS Account with programmatic access.
  • Terraform installed (v1.x recommended).
  • AWS CLI configured with appropriate IAM permissions.

🚀 How to Deploy

  1. Clone the repository
git clone <repo-url>
cd vpc-terraform-project
  1. Initialize Terraform
terraform init
  1. Validate the configuration
terraform validate
  1. Plan the deployment
terraform plan
  1. Apply the configuration
terraform apply -auto-approve
  1. Access the Application
  • Copy the DNS name of the ALB from Terraform outputs.
  • Visit it in your browser.

🧹 Cleanup

To destroy all created AWS resources:

terraform destroy -auto-approve

📜 License

This project is licensed under the MIT License.

About

This project provisions a custom Virtual Private Cloud (VPC) on AWS using Terraform. It includes subnets, an Internet Gateway, route tables, security groups, EC2 instances with user data, and an Application Load Balancer. The setup demonstrates how to create a secure, scalable network architecture following AWS best practices.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published