Description:
Develop a system that automatically manages the lifecycle of a web application hosted on EC2 instances, monitors its health, and reacts to changes in traffic by scaling resources. Furthermore, administrators receive notifications regarding the infrastructure's health and scaling events.
Detailed Breakdown:
- Web Application Deployment:
-
Use
boto3
to: -
Create an S3 bucket to store your web application's static files.
-
Launch an EC2 instance and configure it as a web server (e.g., Apache, Nginx). - Deploy the web application onto the EC2 instance.
- Load Balancing with ELB:
-
Deploy an Application Load Balancer (ALB) using
boto3
. -
Register the EC2 instance(s) with the ALB.
- Auto Scaling Group (ASG) Configuration:
-
Using
boto3
, create an ASG with the deployed EC2 instance as a template. -
Configure scaling policies to scale in/out based on metrics like CPU utilization or network traffic.
- SNS Notifications:
-
Set up different SNS topics for different alerts (e.g., health issues, scaling events, high traffic).
-
Integrate SNS with Lambda so that administrators receive SMS or email notifications.
- Infrastructure Automation:
-
Create a single script using
boto3
that: -
Deploys the entire infrastructure.
-
Updates any component as required.
-
Tears down everything when the application is no longer needed.
- Optional Enhancement – Dynamic Content Handling:
-
Store user-generated content or uploads on S3.
-
When a user uploads content to the web application, it gets temporarily stored on the EC2 instance. A background process (or another Lambda function) can move this to the S3 bucket and update the application's database to point to the content's new location on S3.