Tech Junkie Blog - Real World Tutorials, Happy Coding!: Iaas With AWS: Setup Auto Scaling With Application Load Balancer

Wednesday, October 20, 2021

Iaas With AWS: Setup Auto Scaling With Application Load Balancer

 In this pose we are going to implement auto scaling on our instances.  Auto scaling is a feature on AWS that automatically scaled horizontally either based on metrics or the health of an instance. In this post we are going to setup auto scaling on an Application Load Balancer.  

1. The first thing we have to do is setup an Auto Scaling Group under "Auto Scaling" click on "Auto Scaling Groups"

2. Click on the "Create Auto Scaling group" button

3. Give your auto scaling group a name, then click on the "Create a launch template"



3. Give your template a name, then scroll down to AMI type


4. Select Amazon Linux 2 as the image, t2.micro as the instance type, and specify the "Key pair(login)"

5.  Accept the default VPIC, and expand "Advance Details" and paste the following into the "User Data" to install Apache Web Server, then click on "Create launch template"

#cloud-boothook
#!/bin/bash
#Use this for your user data (script without newlines)
# install httpd (Linux 2 version)

yum update -y 
yum install -y httpd.x86_64 
systemctl start httpd.service 
systemctl enable httpd.service 
echo "Hello world from $(hostname -f)" > /var/www/html/index.html
cd /var/www/html/
cp index.html contacts.html

6. Click on "Create Auto Scaling Group"

7. Continue creating your Auto Scaling Group, as you will see the template has been selected for you, click "Next", accept the default then click "Next"



8. Accept the default, and then select the subnets you want your instances to be created in, then click "Next"
9. On the group size, type following value. We basically say we want 3 capacity, and the max an min instances is between 2 and 4.

10.  For scaling policies, set a policy to scale when the CPU is 50% or more
11. Click "Next" until you see the "Review" page, then click on  "Create Auto Scaling group" then click on the button.

12. If you select the Auto Scaling group and click on the "Activity" tab you will see that it is in the process of creating three instances that we specified as our desired capacity.


13. If you look at the instance you will see that three new instances have been created


14.  So now we can create our load balancer to tie all of this together
15. Create an Application Load Balancer, when choosing the subnet, make sure you choose the same subnets as the ones you used for your Auto Scaling Group.  If you need directions on how to create an Application Load Balancer, you can go to this post.

16.  Choose the Security Group that has HTTP traffic on port 80
17. For routing create a new Target group and accept the default
18.Under "Advanced health check settings" change the "Healthy threshold" value to 3, then click "Next"

19. Skip the "Register Targets" because we want the load balancer to pick up the instances that the Auto Scaling group creates, click "Next" until you see the "Create" button, click on it.
20.  Go back to the Auto Scaling group page, then select the Auto Scaling group and click on the "Edit" button.




20.  Under  "Load balancing" select the Target group that you created in the load balancer, then click "Save"

21. Now we can test to see if the Auto Scaling work, the easiest way to test it is to terminate one of the instances.  Since we specify that we desired at least 2 (the minimum), a new instance should be created automatically

22. As you can see a new instance is automatically created

If you want to test the CPU utilization metrics you can follow the instruction here to put stress on your server https://acloudxpert.com/install-stress-utility-on-amazon-linux-2/
 
Previous: Iaas With AWS: Create An Application Load Balancer (Host)

24 comments:

  1. Wow, impressive!!! Amazing post, I found a lot of interesting information here. I really appreciate your article. Going to read more new posts.

    Find out Dream 11 predictions for today's match & fantasy cricket tips. We Provides 100% true match prediction with free fantasy tips. We cover all major cricket tournaments and matches.

    ReplyDelete
  2. Food and recipes
    Thank you admin for your useful information . I think your dedication is inspiring. This note is just an extension of what we all already know. We couldn’t do it without you.

    ReplyDelete
  3. Hi,
    Thanks for sharing this beautiful and informative article.
    I have really enjoyed reading the article and of course learned several new things from your content.
    I would definitely share this blog on my social media pages.
    Looking forward and waiting for your new blogs
    Thank you

    ReplyDelete
  4. Hi,
    Thanks for sharing this beautiful and informative article.
    I have really enjoyed reading the article and of course learned several new things from your content.
    I would definitely share this blog on my social media pages.
    Looking forward and waiting for your new blogs
    Thank you

    ReplyDelete
  5. Hi,
    Thanks for sharing this beautiful and informative article.
    I have really enjoyed reading the article and of course learned several new things from your content.
    I would definitely share this blog on my social media pages.
    Looking forward and waiting for your new blogs
    Thank you

    ReplyDelete
  6. Here you Provided really good information, really appreciate your efforts it. Properties in Udaipur and Affordable housing in Udaipur

    ReplyDelete

  7. hi thanks for sharing i found something new on my blog driver booster pro key

    ReplyDelete
  8. Hi,
    Thanks for sharing this beautiful and informative article.
    I have really enjoyed reading the article and of course learned several new things from your content.
    I would definitely share this blog on my social media pages.
    Looking forward and waiting for your new blogs
    Thank you



    ReplyDelete
  9. Bethel Home Healthcare, LLC. is licensed through the Department of Mental Health for the state of Missouri. Bethel was founded by Darlene Davis in 2017 with a vison to improve the quality of life of individuals struggling with mental health and intellectual disabilities.

    ReplyDelete
  10. Hi,
    Thanks for sharing this beautiful and informative article.
    I have really enjoyed reading the article and of course learned several new things from your content.
    I would definitely share this blog on my social media pages.
    Looking forward and waiting for your new blogs
    Thank you

    ReplyDelete
  11. Didn't know this was even possible, thanks for sharing.
    buy logo

    ReplyDelete
  12. Such a detailed article. Everyone must learn AWS skills now a days! Thanks for Sharing. Style Us

    ReplyDelete
  13. We are a team of professionals that are very keen on providing honest reviews about gaming laptops and accessories. We are working our best to make your purchase long-lasting and reliable. All the reviews on our site are totally genuine and neutral, we never favored any brand or product by our own will. All the reviews are based on deep research and analysis. Visit our website to learn more!

    ReplyDelete
  14. best bizz is the UK most trusted website which provide list of leading businesses in the UK.Improvement agency, assisting with growing your business to be more profitable, sustainable and successful.. Visit our website to learn more!

    ReplyDelete
  15. I have really enjoyed reading the article and of course learned several new things from your content.

    ReplyDelete
  16. I have really enjoyed reading the article and of course learned several new things from your content.
    Thanks for sharing this helpful post

    ReplyDelete
  17. We have a group of master cleaners to play out the best assignment of cleaning the carpets in the most ideal manner and get the ideal result by our cleaning interaction. Master Carpet Cleaning is one of the most recommended companies across Australia thanks to its years of experience and expertise. Our primary goal is to ensure that all our clients are beyond satisfied with our cleaning services.

    ReplyDelete
  18. Pro Sofa Clean is one of the most professional sofa and couch cleaning companies in Sydney. We aim to extend the life of your old domestic, office and commercial sofa or couch by cleaning it to look and feel good as new. Visit our website to learn more!

    ReplyDelete
  19. Same Day Sofa Cleaning Wollongong Experts. Doorstep Couch Cleaning Wollongong Service Today. Upholstery Cleaning experts available any day.

    ReplyDelete
  20. At Pro Sofa Clean, we know how important it is to make sure your sofa gets properly cleaned, which is why we send our expert cleaners to handle sofa cleaning Punchbowl and all surrounding areas with the utmost care and attention to detail.

    ReplyDelete
  21. Find here Sofa Cleaning Hornsby, Upholstery Couch Steam Cleaning Services in Hornsby Sydney. Pro Sofa Clean offers solid Couch and Sofa Cleaning Services in Hornsby. Book now Same day Upholstery Couch Steam Cleaning.

    ReplyDelete
  22. Professional Couch Cleaning Annandale Experts. Doorstep Upholstery Cleaning Annandale. Call Now for Sofa Cleaning Annandale.

    ReplyDelete
  23. Looking for Sofa Cleaning Hurstville? Doorstep Sofa Cleaning Hurstville NSW Available Today. Same Day Couch Cleaning Hurstville. Call us Upholstery Cleaning Hurstville.

    ReplyDelete

Search This Blog