Autoscaling Group
- Create Autoscaling group from EC2 Tab
- Separate Security Group
- Select Subnets
- Create Template | Within Template try following Code
- Select Custom Data Setting at last | OS - Amazon Linux 2023 | Paste following code.
- Monitor Changes
- Edit minimum, desired, maximum instances configuration from Autoscaling Group Setting
Steps for terminating
-
Delete Autoscaling Group
-
Delete Security Group
-
Delete Launch Templates | EC2 Tab
-
Delete Subnet
#!/bin/bash yum update -y yum install httpd -y yum install php -y service httpd start service httpd enable chown -R ec2-user:apache /var/www chmod 2775 /var/www cd echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
OR
!/bin/bash
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
chmod 777 /var/www/html/
echo "<h1> hello from atul $(hostname -f) </h1>">/var/www/html/index.html