Code Monkey home page Code Monkey logo

td-homework's Introduction

TD Homework Project

This project contains an Amazon Web Service CloudFormation template and support scripts to provision and deploy a set of web servers behind an Elastic Load Balancer. The deployment leverages Amazon's Virtual Private Cloud and subnets in different Availability Zones.

To access the infrastructure, you must first log into the DevOps workstation which is included with the provisioning.

The below diagram illustrates the deployment.

AWS Architecture

The default configuration is to provision three (3) web servers in private subnets. The elastic load balancer will broker the HTTP and HTTPS connections and distribute the requests among the available machines:

AWS Registered Instances

The create and manage the CloudFormation stack, a set of helper scripts (examples) are provided for command line use in the CloudFormation folder (./cf/*.sh).

Script Name Purpose
create-stack.sh Creates the CloudFormation stack in AWS
delete-stack.sh Deletes the CloudFormation stack in AWS
get-stack-status.sh Provides some diagnostic output and status information about a given CloudFormation stack in AWS
list-stacks.sh Returns a list of CloudFormation stacks under your account in AWS
update-stack.sh Updates the CloudFormation stack in AWS
validate-template.sh Validates the CloudFormation template - this is also done prior to creating or updating the stack

Other utility scripts are provided for logging and colorized output.

Prerequisites

  • Must have an account in AWS with AWS Access Key and AWS Secret Access Key
  • Must have the AWS command line tools installed and configured (~/.aws/config and ~/.aws/credentials)
  • Must have a SSH key created or registered within your AWS account

Notes

This CloudFormation template is designed to deploy in the US West 2 region. The web servers and NAT router are not accessible via SSH tcp port 22 unless you first jump to the DevOps box.

TODO

  • Configure NGINX to run as non-root user
  • Configure Apache2 to run as non-root user
  • Configure ELB to listen TLS over port 443 - CloudFormation needs SSL setup details to bind to HTTPS

Testing

To validate the deployment, review the CloudFormation output for the ELB host. Open the ELB host link in a web browser.

Alternatively, log into the DevOps box and run the following (just an example - you'll need to adjust the default Security Group of the ELB for the DevOps box to access the ELB via HTTP/S):

ubuntu@ip-10-0-0-243:~$ for i in `seq 1 100`; do curl -s http://internal-ElasticLoadBalancer-2120497040.us-west-2.elb.amazonaws.com | grep Hello; sleep 1; done
  <h1>Hello! NGINX is Running on Web 2</h1>
  <h1>Hello! NGINX is Running on Web 2</h1>
  <h1>Hello! NGINX is Running on Web 2</h1>
  <h1>Hello! NGINX is Running on Web 2</h1>
  <h1>Hello! Apache2 is Running on Web 3</h1>
  <h1>Hello! Apache2 is Running on Web 3</h1>
  <h1>Hello! Apache2 is Running on Web 3</h1>
  <h1>Hello! NGINX is Running on Web 1</h1>
  <h1>Hello! Apache2 is Running on Web 3</h1>
  <h1>Hello! NGINX is Running on Web 1</h1>
  <h1>Hello! NGINX is Running on Web 2</h1>
  <h1>Hello! NGINX is Running on Web 1</h1>
  <h1>Hello! Apache2 is Running on Web 3</h1>
  <h1>Hello! Apache2 is Running on Web 3</h1>
  <h1>Hello! NGINX is Running on Web 1</h1>
  <h1>Hello! NGINX is Running on Web 1</h1>
  <h1>Hello! Apache2 is Running on Web 3</h1>
^C

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.