Skip to content

Instantly share code, notes, and snippets.

@atulkamble
Last active September 14, 2023 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save atulkamble/1a1dd4072b0ce4ab8988e7920c8a2218 to your computer and use it in GitHub Desktop.
Save atulkamble/1a1dd4072b0ce4ab8988e7920c8a2218 to your computer and use it in GitHub Desktop.
autoscaling-EC2

Autoscaling Group

  1. Create Autoscaling group from EC2 Tab
  2. Separate Security Group
  3. Select Subnets
  4. Create Template | Within Template try following Code
  5. Select Custom Data Setting at last | OS - Amazon Linux 2023 | Paste following code.
  6. Monitor Changes
  7. 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 "&lt;h1&gt; hello from atul $(hostname -f) </h1>">/var/www/html/index.html

Autoscaling Group

  1. Create Autoscaling group from EC2 Tab

  2. Separate Security Group

  3. Select Subnets

  4. Create Template | Within Template try following Code

  5. Select Custom Data Setting at last | OS - Amazon Linux 2023 | Paste following code.

  6. Monitor Changes

  7. Edit minimum, desired, maximum instances configuration from Autoscaling Group Setting

    #!/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 "&lt;h1&gt; hello from atul $(hostname -f) </h1>">/var/www/html/index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment