Coder Social home page Coder Social logo

aws-terraform-network's Introduction

High Availability and Scalability Demo

This project demonstrates deploying a high availability infrastructure on AWS using Terraform.

This demonstration highlights high availability through the creation of key AWS components using Terraform: a VPC with public subnets, an Internet Gateway, and a route table. It includes setting up key pairs, security groups, a target group, EC2 instances, and an Elastic Load Balancer for efficient traffic distribution. This example performs the following steps:

  1. Provision a VPC.
  2. Create and attach an Internet Gateway to the VPC.
  3. Set up a route table within the VPC.
  4. Create two public subnets in separate availability zones within the VPC.
  5. Associate both subnets with the route table.
  6. Configure a security group that permits HTTP and SSH traffic for EC2 instances (EC2 Security Group).
  7. Launch EC2 instances in each public subnet.
  8. Associate the security group with the EC2 instances to allow HTTP and SSH traffic.
  9. Establish a target group and register both EC2 instances with it.
  10. Create a security group for the Elastic Load Balancer, permitting HTTP traffic.
  11. Deploy the Elastic Load Balancer using Terraform.
  12. Configure inbound rules to allow traffic from the Load Balancer to the EC2 Security Group.
  13. Generate a key pair on AWS for accessing the EC2 instances.
  14. Provision the EC2 instances using the web.sh script, which installs the httpd service on Ubuntu, creates an index.html file in the var/www/html directory, and writes instance metadata to the index.html.

Infrastructure Diagram

Infrastructure Diagram

How to use this example project

  • Create a folder named keys on the root of the folder.
  • Generate 2 keys namely web01key and web02key using ssh-keygen.
  • Put them in the keys folder.
  • Setup AWS CLI.
  • Generate keys on AWS to use with AWS CLI.
  • Install terraform.

Run these commands from the root directory of the project

terraform init
terraform validate
terraform plan
terraform apply

Improvements

Improve Infrastructure Diagram

To enhance the security of our network, we can add private subnets and move our EC2 instances into these subnets. However, since instances in private subnets are not directly accessible from the internet, it is necessary to create a NAT Gateway to enable outbound internet access.

Utilizing auto-scaling groups to launch instances adds scalability to the network, automatically adjusting resources based on demand. This approach enhances performance, maintains availability, and optimizes cost efficiency by scaling up or down as needed.

Find a bug

If you encounter an issue or have suggestions for improving this project, please submit an issue via the "Issues" tab above.

Author

Sharique Ali

LinkedIn

aws-terraform-network's People

Contributors

sharique-tech1987 avatar skhan1987 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.