1 Answer
- Newest
- Most votes
- Most comments
1
Thank you for posting your question.
Sorry for long answer, I'd approach this in following steps:
1. Set up Auto Scaling Groups (ASGs):
- Create two ASGs: one for the 64 GB instance and one for the 8 GB instance.
- Configure the 64 GB ASG with a minimum of 1 instance and a maximum of X instances (depending on your expected peak traffic).
- Configure the 8 GB ASG with a minimum of 1 instance and a maximum of Y instances (depending on your expected off-peak traffic).
2. Configure Application Load Balancer (ALB):
- Create an ALB and configure two target groups, one for each ASG.
- Set up health checks to ensure that only healthy instances receive traffic.
- Configure the ALB to use weighted target group routing.
3. Implement Auto Scaling Policies:
- Create CloudWatch alarms to monitor your website's traffic patterns.
- Set up auto scaling policies to automatically scale the 64 GB ASG up and down based on the traffic thresholds.
- Scale up the 64 GB ASG during peak hours (e.g., 7 PM to 12 AM).
- Scale down the 64 GB ASG and scale up the 8 GB ASG during off-peak hours.
- Use the weighted target group routing to gradually shift traffic between the two instance types during scaling operations.
Lastly I'd advise to test it thoroughly making sure that:
- Seamless transition between the 64 GB and 8 GB instances.
- Verify that the user experience is not disrupted during the scaling process.
- Monitor the system's performance and adjust the scaling policies as needed.
Additionally, refer following documentation, you might find them helpful as alternate approaches to handle the same situation:
- https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups-instance-weighting.html
- https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-configurations.html
- https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-scheduled-scaling.html
Comment here if you have additional questions, happy to help.
Abhishek
Relevant content
- asked 2 years ago
- asked 21 days ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a month ago
- AWS OFFICIALUpdated 2 months ago
Is there a reason you need to change instance sizes vs horizontally scaling multiple 8GB instances? The issue with an ALB approach is that there will be 2 instances running for a brief period. So if your application supports 2 instances running at once, why not just scale normally vs changing sizes and adding complexity of 2 ASGs?