Skip to content

Using Load balancer and Auto-Scaling to support horizontal scalability for the web application

Notifications You must be signed in to change notification settings

huyphamch/terraform-aws-create-scalable-web-rds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

James, a systems engineer at a startup company, is tasked with developing a secure, robust, and scalable web application and backend database.
The company plans to utilize AWS RDS for the database, while the application will be deployed on an EC2 instance.
James must ensure a secure VPC setup where the EC2 instance and the RDS DB instance reside in a private subnet.

Objectives

As a cloud architect, your objective is to assist James in developing an AWS VPC that hosts both an EC2 instance and a database instance.
A solution is needed in order to handle a lot of http requsts in a secure environment.

Solution

Image
Add Route53 to redirect domain name requests to load balancer.
Add a load balancer to distribute requests to multiple EC2-instances via auto-scaling and ensure responsiveness of the website.
Add auto-scaling to handle requests from the load balancer and dynamically increase/decrease EC2-instances based on CPU usage to support horizontal scalability.
The EC2-instances are better protected in the private subnet and can only be accessed by the load balancer.
The EC2-instances have access to the internet via their own NAT-Gateway through the Internet Gateway in order to download installation packages like the web-server.
The database protected in the private subnet and can only be accessed by the EC2-instances.

Prerequisites


Build on top of code and results from Project 1

Usage


1. Open terminal
2. Before you can execute the terraform script, your need to configure your aws environment first.
aws configure
AWS Access Key ID: See IAM > Security credentials > Access keys > Create access key
AWS Secret Access Key: See IAM > Security credentials > Access keys > Create access key
Default region name: us-east-1
Default output format: json
3. Now you can apply the terraform changes.
terraform init
terraform apply --auto-approve
Note: Update the nameservers from Route53 record in the domain to redirect requests to AWS Route53 nameservers.
Result: Calling the URL from the web browser should display the static web page
4. At the end you can cleanup the created AWS resources.
terraform destroy --auto-approve

About

Using Load balancer and Auto-Scaling to support horizontal scalability for the web application

Resources

Stars

Watchers

Forks

Packages

No packages published