Code Monkey home page Code Monkey logo

terraform-aws-asg-elb_nodejs's Introduction

Creating a Load Balancing between a cluster of Nodejs Apps on AWS with Terraform

this repo is an example of using ELB Elastic Load Balancing with ASG Auto Scaling Group to provide highly available and efficient Nodejs Apps

Deploy a Cluster of Nodejs Apps

we will use ASG to launch a cluster of EC2 Instances, monitoring the health of each Instance, replacing failed Instances, and adjusting the size of the cluster in response to load.

  • ASG distributes the EC2 instances across multiple availability zones
    • each AWS account has access to different set of Availability zones, in this repo, i've choosed all availability zones available in my account

Deploy a Load Balancer

after deploying the ASG you'll have several different servers, each with its own ip address, but you need to give your end users only a single IP to hit, and for this we're going to deploy a load balancer to distribute traffic accross your servers and to give your end users a single dns name which is the the load balancer dns name


Install Terraform On Linux

For other platforms to install Terraform download the binray from the download page

https://www.terraform.io/downloads.html

yum -y install unzip

cd /tmp
wget https://releases.hashicorp.com/terraform/0.11.7/terraform_0.11.7_linux_amd64.zip
unzip terraform_0.11.7_linux_amd64.zip -d /usr/bin/

terraform -v

Usage

Insert your AWS access key & secret key as Environment Variables, In this way we're NOT setting them permanently, you'll need to run these commands again whenever you reopen your terminal

export AWS_ACCESS_KEY_ID=<your access key>
export AWS_SECRET_ACCESS_KEY=<your secret key>
yum -y install git
git clone https://github.com/Eslam-Naser/terraform-AWS-ASG-ELB.git
cd terraform-AWS-ASG-ELB/

# Downloading the Plugin for the AWS provider
terraform init
  • See what's terraform is planning to do before really doing it
terraform plan
  • build the terraform project
terraform apply
# yes | if you want to proceed

Test

<public IPv4>:5000/api/v1.0/task
  • destroy what you've built
terraform destroy
# yes | if you want to proceed

terraform-aws-asg-elb_nodejs's People

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.