Autoscaling group
- Refer Here for creating auto scaling group
- Auto scaling groups helps in scaling ec2 instances horizontally.
- There are two types of scaling
- Fixed Scaling: always maintains the desired count
- Auto Scaling: will have
- minimum
- maximum
- desired
- In Auto scaling the desired count can be set automatically based on Metrics.
- Auto scaling groups require launch templates
Lets create an autoscaling group with Custom AMI
- Navigate to ec2 and create autoscaling group

- Lets create Launch template















- Now lets stress the cpu using stress tool.
stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 15m -v
- Wait for few minutes and look at desired capacity and you should observe increase in number of ec2 instances
- Now kill the stress process wait for few more minutes and then the number of instances will come back to minimum (1)
Lets create ami’s with some decent looking applications in it
- Lets create an AMI based of some website template Refer Here
- In this image we will have phpinfo, stress and website
- Lets create an AMI based on Makaan Refer Here
- Lets create an AMI based on ubuntu
#!/bin/bash
sudo apt update
sudo apt install apache2 stress -y
sudo apt install php libapache2-mod-php php-mysql -y
echo "<?php phpinfo() ?>"> /var/www/html/info.php
sudo apt install unzip -y
- Create an ami called as makaan-v1
- Lets create second version of makaan Refer Here
-
Next Steps
- Scaling Policies
- Load Balancer integration
- Launch template versions
- Auto image creation
- Route 53 integration
