Automating Auto Scaling Group Updates

AWS introduced autoscaling to make EC2 cluster scaling easier. We've seen users constantly make changes to their EC2s and put new policies into play. It’s important to update your Autoscaling group with the new instances so that it doesn’t ignore these machines. AMI updates keep the AutoScaling Groups aware of the changes in instances. When you add new code to your EC2 instance and you need to make sure your existing instances and new instances are both using it, you’ll need an AMI update. There are two means of achieving this.


  • Update the AMI template that the AutoScaling Group uses, and then force each live EC2 instance to update itself with the new AMI template. New EC2 instances will use the updated AMI template. The steps to do this are on this page, below.
  • Write a startup script that will run when a new EC2 instance spawns. The startup script can for example grab your latest code and deploy it to itself.


Most people would prefer it if the AutoScaling Groups automate the update when a new AMI is launched. Currently, DevOps engineers spend time writing Lambda functions to achieve this. 


Current steps include:

  • Create an IAM role for AWS Lambda
  • Create an AWS Lambda function
  • Create an Automation document, patch the AMI, and update the Auto Scaling group

The Lambda function will handle instance termination and launch will update the AMI and patch it onto the ASG.


With automation becoming the forefront of cloud management, we’ve seen a number of users request this use case or template. Scripting just remains time-consuming, especially when dealing with repetitive tasks that contribute to operational governance. 


Now, workflows can reproduce the result without the time constraints brought up when setting up the lambda function and automation document. Using a visual interface, you can perform the AMI creation, template launch, and autoscale update together - with a single workflow. 


You can also integrate Jenkins and other CI/CD software with the workflows so you won’t have to write your automation scripts. Improve the customization capabilities with further integrations. You can update the AMIs based on the different integrations and then in turn update the autoscaling group afterward.


Let’s say you have a development pipeline and during your iterations, you add additional EC2 machines for higher CPU performance. With our workflow integrations, you can automatically update the autoscaling to include the new machines with new AMIs, keeping your development pipeline uninterrupted.





Process

The workflow replicates the entire process of updating your Autoscaling Groups, in a way it mimics human actions. The trigger runs every day to check for updated instances. The nodes, then launch the autoscaling template with the new AMI. The autoscaling group updates the new and existing instances with the new AMI. Afterward, the old EC2 instances are terminated.





Step 1: Trigger

Runs every day and launches based on the changes to the instances.


Step 2: Auto Scaling Group

Loads the autoscaling group.


Step 3: Filter

Filter out the updated instances by tag.


Step 4: Resources

Loads the instances of the auto-scaling group.



Step 5: Filter

Compares the instances of the trigger with the instances of the auto scaling group to determine which requires the creation of AMI.


Step 6: Create AMI


Step 7: Launch Template

Launches the template based on created image with the auto scaling group. 


Step 8 : Update Auto Scaling Group.


Conclusion
Many other use cases can be translated similarly to our workflows. It’s a matter of combining the resources accurately. The building blocks that we’ve laid out with our platform can be used in any number of ways with zero coding. If you have a resource you wish to simplify, try to use our workflows to your advantage.

Automating Auto Scaling Group Updates

Smart Scheduling at your fingertips

Go from simple to smart, real-time AWS resource scheduling to save cost and increase team productivity.

Learn More
More Posts

You Might Also Like

Cloud Computing
List of Essential Kubernetes Tools
Kubernetes is a Container-as-a-Service with tons of unique tools to choose from. External tools play a role in integrating with different systems or maintaining control over the clusters you deploy. Manual health checks and troubleshooting is not ideal to keep a system in full health.This list of tools will provide ample support to your containers and have enough configuration to leave management flexible...
August 12, 2020
Hrishikesh
AWS Use Case Files
TotalCloud Inventory Actions: Giving a new meaning to Cloud Inventory
Learn how the TotalCloud Inventory Dashboard can become equivalent to your cloud provider’s SDK. Carry out any action on any discovered resource with Inventory Actions.
July 30, 2020
Sayonee
AWS Tips & Tricks
AWS Tutorial: Create an AWS Instance Scheduler with Terraform
Terraform is a popular IaaS tool used by many to create, update, and maintain their AWS architecture. If you use Terraform to provision your AWS architecture, you won’t be disappointed with our new AWS tutorial video.We provide you with the means to set up your own instance scheduler from Terraform...
July 20, 2020
Hrishikesh
Cloud Computing
Azure vs AWS: What you need to know
Companies that have jumped the gun with cloud migration during this time of crisis have committed a fatal mistake. The knowledge gap among businesses that seek to migrate is often underestimated, leading to devastating expenditures and operational inefficiencies...
July 15, 2020
Hrishikesh
AWS Use Case Files
Auto Remediation: Increase DB size when Disk Space Utilization Crosses 90%
A common occurrence in Instance management is the risk of overutilization of disk space. Several factors can cause an increase in Diskutilization to go over 90%. For example, user-initiated heavy workloads, analytic queries, prolonged deadlocks, and lock waits, multiple concurrent transactions, long-running transactions, or other processes that utilize CPU resources...
July 3, 2020
Hrishikesh
AWS Use Case Files
Launch EC2 Instances with CloudFormation
CloudFormation is the gateway to Infrastructure-as-code for AWS users. Learn how you can deploy Cloudformation templates through Totalcloud workflows and increase your customization.
June 25, 2020
Hrishikesh