Project Website: http://onyekachukwuejiofornweke.me
Please NAT gateway was recently deleted and Elastic IP released due to cost reasons.
From the Diagram above requirements needed for the project:
- VPC
- Four (4) Subnets
- Three (3) Route Tables
- One (1) Internet Gateway
- Two Nat Gateway
- Launch Template for AutoScaling Group
- AutoScaling Group (ASG)
- One (1) Application Balancer
VPC is used to isolate cloud resources in a public cloud by creating a private cloud.
I created four subnets, 2 private and 2 public each Availability Zone has Two subnets(1 public and 1 private)
The NAT gateway will be placed in the public subnets to be able to allow them to connect to the internet and provide a routing gateway for the private subnets
The main route table is the default route table and the Internet gateway will be connected to it.
While the other private route tables will be routed to the NAT gateway to allow the private instances internet access
Internet gateways are created for VPCs to connect to the internet through routing tables.
NAT gateways are used to provide resources especially instances in private subnets with internet access and are connected to those subnets through routing tables.
Elastic IPs are assigned to nat gateways
A Launch template is used for the creation of an AutoScaling Group so that the machine type used will be uniform to avoid infrastructural failure.
The ami id is used to create an identical machine instance for the project.
A security group is created for the template having port 80 for inbound and all traffic for outbound
And I created a launch script in the user data section which is also in user_data.sh
#!/bin/bash
sudo apt update -y
sudo apt install -y --no-install-recommends php8.1
sudo apt-get install -y php8.1-cli php8.1-common php8.1-mysql php8.1-zip php8.1-gd php8.1-mbstring php8.1-curl php8.1-xml php8.1-bcmath php8.1-fpm
sudo systemctl reload php8.1-fpm
git clone https://github.com/Onyekachukwu-Nweke/server_stats_template.git
sudo apt install -y nginx
sudo mv server_stats_template/assets /var/www/html/
sudo mv server_stats_template/index.php /var/www/html/
git clone https://github.com/Onyekachukwu-Nweke/Alt-School-Sem3-Holiday-Project.git
sudo cat Alt-School-Sem3-Holiday-Project/nginx | sudo tee /etc/nginx/sites-available/default
sudo mv /var/www/html/index.nginx-debian.html ../
sudo systemctl reload php8.1-fpm
sudo systemctl restart nginx
The nginx file is for the configuration of nginx for target machine
An Auto Scaling group contains a collection of EC2 instances that are treated as a logical grouping for the purposes of automatic scaling and management. The ASG is used to avoid infrastructural failure.
In ASG you fill the amount of instances you want at every given time.
You can also fill in the subnets and avaialability zones where the instances will be created.
According to the project requirement I ensured that the private instances did not have a public ip address.
Application Load Balancer is used to evenly distribute network traffic from http and https requests. It sits at the very front of the vpc.
While creating an ASG I created an ALB and its target group also.
Port 80 is opened on the target group.
Target groups are where the ALB will be routing traffic to.
I created a hosted zone and a record using AWS service Route 53 for http://onyekachukwuejiofornweke.me
- Patrick Aziken (Php template file)