Skip to content

Deploy web servers for a highly available web app using CloudFormation

Notifications You must be signed in to change notification settings

vithumathi/webapp-cloudformation

Repository files navigation

Deploy a High-Availability Web App using CloudFormation

Use aws CloudFormation to set up network infrastructure, deploy servers, and create security roles for a highly available web app. The script deploys the application (Apache Web Server), along with the necessary supporting software into its matching infrastructure, pick up code (JavaScript and HTML) from S3 Storage and deploy it in the appropriate folder on the web server.

Features

  1. Load-balanced servers with auto-scaling capability across two availability zones within a single region.

  2. Server/instance specification: 2vCPUs, 4GB RAM, 10GB disk space.

  3. Linux Operating System using the Ubuntu distribution machine image.

  4. Compute instances are secured in a private subnet and only accepts traffic originating from a bastion host and load-balancer both within a public subnet.

  5. Each availability zone contain a bastion host to enable SSH to instances in each of the private subnets for debugging and troubleshooting.

  6. Load-balancer, bastion host, and application servers have security groups defined with only needed ports opened.

  7. Application servers have outbound internet access via NAT gateway for critical OS updates and patches.

  8. Sample application code is packaged and stored in an S3 bucket with IAM permissions.

  9. Application servers are configured with IAM instance profile to be able to access and download application code from AWS S3 bucket.

  10. Application code is deployed in a dockerized apache web server for added security and isolation.

  11. Health checks and thresholds are defined to aid in system availability detection. Metrics are collected, aggregated, and monitored via AWS CloudWatch.

  12. Entire environment is fully virtualized in a cloud platform that can be taken down and brought back up within a short period of time. The process of creating and starting all the services, spinning up instances are automated via scripts in this repo.

Detailed Infrastructure Architecture

alt text

Getting Started

Prerequisites

  1. AWS account
  2. aws cli is installed and configured

Files

  1. Three helper scripts:
    • create.sh - creates the cloudformation stack
    • delete.sh - deletes an existing cloudformation stack
    • update.sh - updates the cloudformation stack
  2. network-infra.yml - Network CloudFormation script
  3. network-infra-parameters.json - parameter values used by network CloudFormation script
  4. servers-config.yml - Servers CloudFormation script
  5. servers-parameter.json - - parameter values used by servers CloudFormation script

Deploy infrastructure

Create network infrastructure followed by servers deployment as servers depend on outputs generated by network infrastructure

> ./create.sh <stack-name> network-infra.yml network-infra-parameters.json
> ./create.sh <stack-name> servers-config.yml servers-parameter.json

For updates to the stack:

> ./update.sh <stack-name> network-infra.yml network-infra-parameters.json
> ./update.sh <stack-name> servers-config.yml servers-parameter.json

To delete the stack:

> ./delete.sh <stack-name>

Credits

Cloud DevOps Engineer Nanodegree Program

About

Deploy web servers for a highly available web app using CloudFormation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages