0% found this document useful (0 votes)
118 views4 pages

Task 7 - Creating An EC2 Auto Scaling Group - Welcome To STP Containers On AWS - Labs

The document describes how to create an Auto Scaling group in AWS to automatically scale Amazon EC2 instances. It involves defining the Auto Scaling group across two Availability Zones, specifying the launch template, capacity limits, and load balancer target group. Within a few minutes, new instances will be launched and registered with the load balancer. The ELB DNS name can then be accessed to validate the application is working correctly with automatic scaling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views4 pages

Task 7 - Creating An EC2 Auto Scaling Group - Welcome To STP Containers On AWS - Labs

The document describes how to create an Auto Scaling group in AWS to automatically scale Amazon EC2 instances. It involves defining the Auto Scaling group across two Availability Zones, specifying the launch template, capacity limits, and load balancer target group. Within a few minutes, new instances will be launched and registered with the load balancer. The ELB DNS name can then be accessed to validate the application is working correctly with automatic scaling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

TASK 7: CREATING AN EC2


AUTO SCALING GROUP
An Auto Scaling group contains a collection of Amazon EC2 instances that are treated as a
logical grouping for the purposes of automatic scaling and management. Amazon EC2 Auto
Scaling enables you to take advantage of the safety and reliability of geographic redundancy by
spanning Auto Scaling groups across multiple Availability Zones within a Region.

After completing the steps in this Task, you will have the architecture as in the following diagram:

1. Create Auto Scaling Group


export asgSubnet1Id=`aws ec2 describe-subnets --filters
Name=tag:Name,Values=wa-private-subnet-1 --query 'Subnets[*].SubnetId' --
output text --region us-west-2` && echo asgSubnet1Id=$asgSubnet1Id >>
~/.bashrc

export asgSubnet2Id=`aws ec2 describe-subnets --filters


Name=tag:Name,Values=wa-private-subnet-2 --query 'Subnets[*].SubnetId' --
output text --region us-west-2` && echo asgSubnet2Id=$asgSubnet2Id >>
~/.bashrc

export waLaunchTemplate=`aws ec2 describe-launch-templates --launch-template-


names waLaunchTemplate --query 'LaunchTemplates[*].LaunchTemplateId' --output
text --region us-west-2` && echo waLaunchTemplate=$waLaunchTemplate >>
~/.bashrc

aws autoscaling create-auto-scaling-group --auto-scaling-group-name


"waAutoscaleGroup" --launch-template LaunchTemplateId=$waLaunchTemplate --
min-size "2" --max-size "4" --target-group-arns $waTg --vpc-zone-identifier
"$asgSubnet1Id,$asgSubnet2Id"

2. Go to EC2 service and after ~2-3 minutes you could see that a couple of new instances are
being created. Make sure to refresh the page to see the updated instance information.

3. From the left pane, select Load Balancers and click on DNS name icon.
4. Paste the ELB DNS name in a web browser. The application may take a couple of minutes to
be fully deployed, before that you could get a “502 Bad Gateway” error, this is because the
instances are still bootstrapping and the ELB has not registered them yet. After you see the
application displayed please insert a couple of new items to validate the application is
working correctly.
 

You might also like