somrajroy / OpenSourceProject-Terraform-AWS-EC2-ELB-CrossZone-LB

Reusable cross zone LB AWS environment with Terraform. Templated infrastructures or on-demand environments with IaC for dev/test environment or client demo's. Deploy a Set of EC2 Instances behind an ALB.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Open Source Project - AWS Cross Zone load balacing on-demand infrastructure with Terraform. Immutable infrastructure.

On-demand environments with IaC for client demo's & DEV/Test Enviornments.

  • Infrastructure-as-Code (IaC) is the key topic in Operational Exellence pillar of "AWS Well-Architected Framework". IaC enables customers to have consistent, templated, sandbox development, test, and production environments with increasing levels of operations control. Automation allows to create & replicate workloads at low cost and avoid the expense of manual effort. Most importantly it allows for evolutionary architectures.
  • In the cloud, customers can apply the same engineering discipline that they use for application code to their entire environment. They can define your entire workload (applications, infrastructure) as code and update it with code.By performing operations as code, customers can limit human error and enable consistent responses to events.
  • This reusable infrastrucuture demonstrates AWS Cross zone Load Balancing with Terraform. Deploy a Set of EC2 Instances behind an ALB. This Terraform code can very easily be extended for more complex enterprise grade infrastructure creation.
  • Terraform is used to create the below reusable complex infrastructure which can be created and destroyed as many times as possible. The terraform code is complex and uploaded in the "sourcecode" folder.
  • Good quality Cloud Architecture diagrams can be done easily in draw.io. It is a cloud based tool with minimal hassles.

image

  • Areas covered :
    • Operational Excellence Pillar of AWS Well Architecture (IaC) & templated infrastructure.
    • Automation : Creating reusable and repeatable infrastuctures.
    • Elastic Load Balancing (ELB) : ELB is an effective way to increase the availability of a system and distributes incoming traffic to application across several EC2 instances.
    • AWS Networking : VPC, Subnets, Route tables, Internet gateway, EIP's etc.
    • Bootstrapping
    • Terraform advanced
  • Once the infrastructure is deployed then & the DNS of the ALB is viewed in browser the response will come from 1 of the 3 EC2 machines from different AZ's in us-west-2 region. When the page is refreshed then each time it can be seen that the response is coming from a different EC2 machine in different AZ as in the images below.
  • The page displays the IP address & AZ of the EC2 machine sending the response as in below images.
  • The shell Script in "awsuserdata.sh" bootstrap's the instances and prints the AZ & IP of the instances. It installs an apache server which listens of port 80.

image

image

image

  • AWS resources deployed :
    • VPC - virtual private cloud
    • 3 Public Subnets
    • Internet Gateway
    • Public Route Tables
    • Security Groups
    • 3 EC2 Instances
    • Target Group
    • Application Load Balancer

About

Reusable cross zone LB AWS environment with Terraform. Templated infrastructures or on-demand environments with IaC for dev/test environment or client demo's. Deploy a Set of EC2 Instances behind an ALB.


Languages

Language:HCL 93.1%Language:Shell 6.9%