AMI image with zay app
#!/bin/bash
sudo apt-get update
sudo apt install nginx unzip -y
cd /tmp/
wget https://templatemo.com/tm-zip-files-2020/templatemo_559_zay_shop.zip
unzip templatemo_2_zay_shop.zip
cd templatemo_559_zay_shop
sudo cp -rf . /var/www/html/
sudo systemctl restart nginx.service
sudo systemctl enable nginx.service
sudo apt-get install stress -y
Auto scaling group
- Auto scaling automatically add or remove ec2 instance in ASG – no manual
How its works:
- define lanch template (configuration of ec2 instance like, instance type, storage, network,security group and IAM role…etc)
- ASG lanches instances (min/max/diserd)
- health check – metrix and application
- scalling policies – conditions to scalling instance
- cpu 80% increase 1 instance
- cpu 60% descrease 1 instance
- loadblancer (Optional)
Pre-requisites:
- lanch template
- vpc and subnets (multiple AZ)
- SNS – topic – enable notification
- loadblancer
Az Distribution:
- Blanced best effort –
- balanced –
- Resvered and balnce
watch class recording and create Auto scaling group
sudo apt-get install stress -y
while true; do
stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 60s -v
sleep 30s
done
