Table of Contents
In this project, I deployed a sample application to to the Apache Web Server running on EC2 instances inside a Private Subnet using the CloudFormation Template ie. Infrastructure as a Code. Some of the properties used in this project are as follows :
Property | Value |
---|---|
Number of web servers | 4-6 |
Region | us-east-1 ie. North Virginia |
Number of Availability Zones Used | 2 |
Subnet | 2 Private Subnets |
Instance Type | t2.micro |
AMI | Ubuntu18 |
Disk Space | 10GB |
Following is the Architecture Diagram of the Infrastructure that was deployed using the CloudFormation Template ๐
Name | Purpose |
---|---|
/scripts | This folder contains the scripts (windows as well as linux) to Create,Update and Delete the Cloudformation stack |
network.yml | This is the template file for the Network Stack |
server.yml | This is the template file for the Server Stack |
parameters-network.json | This file contains the key-value for all the variables that are used in the Network Template |
parameters-server.json | This file contains the key-value for all the variables values that are used in the Server Template |
index.html | This is the webpage used in the LaunchConfiguration |
Here are the steps needed to successfully finish this project.
- AWS account: You would require to have an AWS account to be able to build cloud infrastructure.
- AWS CLI - You need to have AWS CLI installed and profile configured in order to run the AWS commands. You can download the AWS-CLI here
- VS code editor: This editor is helpful to visualize image as well as the code. You can download VS Code editor here
- An account on LucidChart: In order to draw the Architecture Diagrams, you need to have a user account on Lucid Chart
- Create Script
# Ensure that the AWS CLI is configured before running the command below
./create.sh stackName templateFile.yml variableFile.json
- Update Script
# Ensure that the AWS CLI is configured before running the command below
./update.sh stackName templateFile.yml variableFile.json
- Delete Script
# Ensure that the AWS CLI is configured before running the command below
./delete.sh stackName
- Creating Network Stack.
Firstly, we create the Network stack using the following command :
# Ensure that the AWS CLI is configured before running the command below
./create.sh networkStack network.yml parameters-network.json
# This should give back the ARN of the created Stack
- Creating Server Stack.
Once network stack is created, we then create the server stack which using some of the resources created in the Network Stack.
# Ensure that the AWS CLI is configured before running the command below
./create.sh serverStack servers.yml parameters-server.json
# This should give back the ARN of the created Stack
- Once both the stacks are created, we can use the LoadBalancer DNS Name to access the website that is deployed on the EC2 instances in private subnets.
- To demonstrate the working of LoadBalancer, I have displayed the Private IP of the webserver on the top of the page.
- We can see that the IP address is changing which shows that the LoadBalancer is distributing the traffic across all the web servers ๐
Name: Shubham Kandwal
Email: [email protected]
Project Link: Deploying_Highly_Available_WebApp_Using_CloudFormation