Skip to content

galacticrider09/Resilient-Web-Server

Repository files navigation

Resilient Web Server which can auto heal and expand itself.

Note

Using AWS CloudFormation.


This whole project is made as IAC and all the templates can be used by anyone to create their own resources on cloudFormation.

Task 1 :

1.1 : create a public S3 bucket which holds the index.html file.
Screenshot 2025-09-24 at 11 09 21 AM
The database stack was created using the aws clf and database.yaml template was used.
Screenshot 2025-09-25 at 1 48 31 AM
This S3 bucket was created.
Screenshot 2025-09-24 at 11 22 36 AM
Bucket policy.

1.2 : Connect it to an sns topic and configure it to send updates when an object is uploaded in the S3 bucket.
notification.yaml template was used to create and connect the sns topic to the S3.
You get an sns subscription confirmation email just after creating this stack.
Screenshot 2025-09-24 at 11 32 34 AM
This topic sends upload updates on the mail (index.html was uploaded).
Screenshot 2025-09-24 at 11 54 08 AM


Task 2 :

2.1 :Create a IAM role with S3 and CloudWatch full access.
iamrole.yaml is the template used for this.
Screenshot 2025-09-25 at 1 59 55 AM


Task 3 :

3.1 : Create a VPC with IGW , 3 public subnets , route table pointing the subnets to the IGW and a security group.
This was accomplished using networking.yaml .
This file was created using parameters which can be changed in future to create these resources with different parameters.
Vpc-info.json has the info of the VPC and its elements that were created.


Task 4 :

4.1 :Create a User data script for the EC2 launch template(commonly used for installing software or configuring services).
user_data.sh is the User data script used in this case. It installs the httpd , aws cli and syncs the S3 to the instance.


Task 5 :

5.1 : Create EC2 Launch Template.
The EC2 instance Configs :

- Amazon Linux ami 
- T3.micro
- role with s3 and cloudwatch access
- User data script(created earlier)
- Security group(task 3.1)

instance-launchtemp.yaml does the work.

Screenshot 2025-09-25 at 2 30 46 AM


Task 6 :

6.1 :Create auto scaling group with 2 initial instances scale out to 5 if needed, with all 3 subnets selected in the project VPC.
auto-scaling-group.yaml after this stack is created the ASG is configured and it creates the initial 2 instences.
Screenshot 2025-09-24 at 3 35 24 PM


Task 7 :

7.1 :Create SNS topic which sends the auto scaling group status updates on specified email.
sns-instance-updates.yaml
Screenshot 2025-09-25 at 12 58 42 AM
this sends updates like these on email.


Task 8 :

8.1 :Create Classic Load Balancer with configs :

- Public
- Project Vpc selected
- with all subnets in that vpc selected
- Security Group(task 3.1)
- Add CLB to auto scaling group

classic-load-balancer.yaml is the template to create this stack.

we have to update the ASG stack with this CLB arn for this to work.

Screenshot 2025-09-25 at 2 46 31 AM


TESTING : -

test 1 :

Test to check if we get 2 different servers providing output

Screenshot 2025-09-25 at 1 17 11 AM
site 1 with different server and ip.

Screenshot 2025-09-25 at 1 17 18 AM
site 2 with different server and ip.


test 2 :

Increase CPU utilisation of the instances to check if the new instance is created.
Screenshot 2025-09-25 at 1 23 28 AM
increased the cpu utilisation to 100% .
Screenshot 2025-09-25 at 1 32 44 AM
average CPU utilisation of 3 instances.
Screenshot 2025-09-25 at 1 30 15 AM
New instance was initialised and created.


Thanks for reading.

Releases

No releases published

Packages

No packages published