EMAIL SUPPORT

dclessons@dclessons.com

LOCATION

US

How to Configure Launch Configuration & Auto Scaling

How to Configure Launch Configuration & Auto Scaling

How to Configure Launch Configuration & Auto Scaling

Through a launch configuration we can create a template for EC2 instances that have the same predefined configuration. EC2 instances can be created when more instances are required for load balancing from this configuration.

Task:

  • Create a launch configuration of Linus Free Tier of your Choice
  • Select No public IP to be assigned to any instance
  • Select the SG which can provide access to SSH and HTTP protocols ( SG which was created earlier )
  • Use dclessons-new-key.pub as key pair and create the launch configuration.
  • Create the Auto Scaling group using this Launch configuration name would be DCLESSONS-AUTO-SCALE
  • Take size as 1 and select both public and private subnets as created earlier.
  • Configure the following scaling size : Name DCLESSONS-SCALING-SIZE , SCALE Between 1-3 instances , In increase group Size use name DCLESSONS-GROUP-SIZE , execute the policy ALARM is selected.
  • Configure the Following ALARM policies : CPU utilization is Average >=80 for atleast 10 mints

Steps:

Browse to Launch Configurations under AUTO SCALING in the left menu bar. You'll see the following dashboard if there are no Auto Scaling Groups or launch configurations already created:

You will be taken through the same steps that you did while creating an EC2 instance. Select your favourite AMI by clicking on Select as shown following as per task .

Click Next: Configure details. Provide the Name. Click on the Advanced Details and put the following lines in the textbox. It will install Apache, PHP, and MySQL in the server. It will also start the Apache server once the EC2 is running:

#!/bin/bash
yum update -y
yum install -y httpd24 php56 mysql55-server php56-mysqlnd
service httpd start
chkconfig httpd on
groupadd www
usermod -a -G www ec2-user
chown -R root:www /var/www
chmod 2775 /var/www
find /var/www -type d -exec chmod 2775 {} +
find /var/www -type f -exec chmod 0664 {} +
echo "" > /var/www/html/phpinfo.php

In the IP Address Type, choose the option Do not assign a public IP address to any instances, as we want to access the instances only through the load balancer. Click on Next: Add Storage. Leave the default options for now. Click on Next: Configure Security Group select the previous SG created.


Comment

    You are will be the first.

LEAVE A COMMENT

Please login here to comment.