Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Creating a Custom AMI and Deploying an Auto Scaling Group behind an Application Load Balancer

During this hands-on lab you will undergo the process of standing up a working Web Server on Amazon EC2, creating a custom AMI using the instance, and then deploying an Auto Scaling Group using the newly created AMI.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 45m
Published
Clock icon Jan 11, 2024

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create AMI of Amazon EC2 Instance

    • Create a new AMI using the running Amazon EC2 instance and name it WebServer.
  2. Challenge

    Create Launch Template

    • Create a new Launch Template named WebServerLT using the recently created WebServer AMI.
    • For Firewall (security groups), select Create security group, name it AllowVpcHTTP, select (Your Custom VPC), and set up the Inbound Security Group Rules to allow HTTP from the VPC (Should have a CIDR of 10.0.0.0/16).
    • Under Advanced details, for the IAM instance profile menu, find and select OurSystemsManagerEC2Profile.
    • Find Detailed CloudWatch monitoring Info and select Enable from the dropdown.
    • Finally, paste the User Data code from the GitHub repo into the User data field and create the launch template.
  3. Challenge

    Create Auto Scaling Group and Scaling Policy

    Create Auto Scaling Group

    • After you've confirmed your new AMI is available, create a new Auto Scaling Group called WebServer-asg using the recently created WebServerLT Launch Template.
    • Set the Auto Scaling Group VPC to Your Custom VPC.
    • Deploy the group into the 3 private subnets.
    • Attach the Auto Scaling Group to a new Internet-facing Application Load Balancer that lives within the 3 public subnets in Your Custom VPC.
    • Forward the HTTP traffic to a new Target Group containing the Auto Scaling Group.
    • Set the Auto Scaling Group desired capacity to 1.
    • Set the Auto Scaling Group minimum capacity to 1.
    • Set the Auto Scaling Group maximum capacity to 3.
    • Create a Target Tracking scaling policy for your Auto Scaling Group.
    • For the scaling policy set the metric type to Average CPU Utilization
    • Set the target value to 50.

    Create New ALB Security Group

    • Create a new VPC Security Group for the Application Load Balancer (ALB).
    • Name it OurALBSecurityGroup.
    • Deploy it into Your Custom VPC.
    • Add an inbound rule that allows all HTTP traffic from all IPv4 addresses.
    • Attach the security group to your new Application Load Balancer fronting your Auto Scaling Group.

    If the settings are not discussed, leave as default.

  4. Challenge

    Test Scaling

    • Connect to the Auto Scaling Group instance using Session Manager.
    • Stress test the CPU using the installed stress application through the following command:
    sudo stress --cpu 2
    

    After a few minutes, this should trigger a scaling action for the Auto Scaling Group.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans