Skip to content

This Terraform code is used to set up an AWS infrastructure that includes a Virtual Private Cloud (VPC), subnets, an internet gateway, route tables, security groups, EC2 instances, an Application Load

Notifications You must be signed in to change notification settings

ishagothwad/Traffic-distributing-website-deployment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Traffic-distributing-website-deployment

This Terraform project sets up a highly available web application on AWS. The infrastructure includes a VPC, subnets, an internet gateway, route tables, security groups, EC2 instances, an Application Load Balancer (ALB), and an S3 bucket.

Architecture Overview

S3pro

Components

  • 🌐 VPC: A Virtual Private Cloud with two subnets in different availability zones.
  • 🌍 Internet Gateway: Enables internet connectivity for the VPC.
  • 🛣️ Route Tables: Direct traffic to the internet gateway.
  • 🔒 Security Group: Controls inbound and outbound traffic for the EC2 instances and ALB.
  • 🖥️ EC2 Instances: Two instances initialized with user data scripts, placed in different subnets.
  • ⚖️ Application Load Balancer (ALB): Distributes incoming traffic across the EC2 instances.
  • 📦 S3 Bucket: Storage for various application data.

Prerequisites

  • Terraform installed on your local machine.
  • AWS CLI configured with appropriate permissions.
  • AWS credentials configured.

Getting Started

Clone the Repository

git clone https://github.com/ishagothwad/Traffic-distributing-website-deployment
cd Traffic-distributing-website-deployment

Initialize Terraform

Initialize the Terraform working directory:

terraform init

Plan the Deployment

Generate and show an execution plan:

terraform plan

Apply the Deployment

Apply the changes required to reach the desired state of the configuration:

terraform apply

Output

After applying, Terraform will output the DNS name of the load balancer:

Outputs:

loadbalancerdns = "your-alb-dns-name"

Use this DNS name to access your web application.

File Structure

  • main.tf: Contains the main Terraform configuration.
  • variables.tf: Defines variables used in the configuration.
  • userdata.sh: Initialization script for the first EC2 instance.
  • userdata1.sh: Initialization script for the second EC2 instance.
  • README.md: This readme file.
  • .gitignore: Specifies files to be ignored by git.

Clean Up

To destroy the infrastructure created by Terraform:

terraform destroy

About

This Terraform code is used to set up an AWS infrastructure that includes a Virtual Private Cloud (VPC), subnets, an internet gateway, route tables, security groups, EC2 instances, an Application Load

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published