Autoscaling Application with AutoScaling Groups and AWS LoadBalancer

In this Blog Post, let us look at how to make your website highly available and scalable using AWS Load Balancer and AutoScaling Groups. If you are looking for Consulting Services then get in touch with us.

Creating AMI:

  • Launch an instance, Setup your application on it and shut it down.
  • Go to your AWS EC2 Console. Select your instance and create AMI, by right-click on the selection and choose Image > Create Image.
  • Wait for it to AMI creation to complete, you can check its status in Image > AMI on the Left Side Menu.
  • Wait for Status to be Available and then terminate the original instance, if needed.

Create Load Balancer:

  • Navigate to Load Balancer Section on Left Side Menu and select Create Load Balancer
  • Choose your Load Balancer Type Appropriately  between Application, Network and Classic Load Balancer.
  • Configure your Security group and other setting Appropriately and Create  a Target Group (dont choose any instances) and wait for the Load Balancer to Launch.
  • After Launch, when you visit Load Balancer URL, It should throw an 503 Service not available exception (which is already expected, since we didnt host our website yet)

Now that all is set, Lets setup Auto Scaling and Load Balancing for your Application.

Creating Auto Scaling Group:

Before we can create a Auto Scaling Group, we need to create a Launch Configuration (you can either use a single AMI to create a Launch Configuration or use Launch Templates.). You can do this by choosing Launch Configuration in AUTO SCALING section on your left-side menu, Click on Create Launch Configuration and choose your previously created AMI, Instance Type and Instance Settings like Security Groups and Storage Settings etc., and complete creation of Launch Configuration.

  • Choose Auto Scaling Groups in “AUTO SCALING” section in left-side menu.
  • Click on “Create Auto Scaling Group”, Choose use existing Launch Configuration and select the configuration you selected earlier.
  • Create Auto Scaling Group with your preferred Settings. Making Sure you select “Receive traffic from one or more load balancers” in Advanced Details.
  • Launch your Auto Scaling Group and wait for instances to Launch
  • Refresh the Load Balancer URL to see your Application.

Testing Auto Scaling Group:

Based on whether you selected CPU Average or Average Network In/Out or Load Balancer Request Count per target. Create a suitable load and check your AWS EC2 instance count increasing and they being Auto Added to your Load Balance Target Group.

Note: If you create a classic Load Balancer, then you will be asked to select the Load Balancer, If you created a Network/Application Load Balancer, you will be asked to choose a Target Group During Creation of Auto Scaling Group.

Posted On 09 February 2019 By MicroPyramid

About Micropyramid

Micropyramid is a software development and cloud consulting partner for enterprise businesses across the world. We work on python, Django, Salesforce, Angular, Reactjs, React Native, MySQL, PostgreSQL, Docker, Linux, Ansible, git, amazon web services. We are Amazon and salesforce consulting partner with 5 years of cloud architect experience. We develop e-commerce, retail, banking, machine learning, CMS, CRM web and mobile applications.

Need any Help in your Project?Let's Talk


Subscribe To our news letter

Subscribe and Stay Updated about our Webinars, news and articles on Django, Python, Machine Learning, Amazon Web Services, DevOps, Salesforce, ReactJS, AngularJS, React Native.
* We don't provide your email contact details to any third parties