IaC, DevOps, Manage EC2 AMI, Launch Template and ASG with Packer and AWS CLI

  1. run EC2 instance with AMI image
  2. mutate the state (run commands) of instance created from step 1
  3. create new AMI image with instance from step 2
  4. modify launch template
  • when instances working with ASG
  • get AMI image running in ASG’s Launch Template for the base image
  • fix the launch template version configured in ASG with current version if it is default or latest to prevent from not intended scaling actions before we actually want to replace.
  1. scale out instances by doubling Desired capacity and also Maximum capacity if needed.
  2. set scale in protection on instances with new launch template to prevent from not being terminated by any termination policies.
  3. scale in instances by modifying back Desired capacity and Maximum capacity.
  4. remove scale in protection on new instances.




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Making an AI for a coding interview question

HTB Walkthrough: SolidState w/o Metasploit (retired)

How to Downscale an Index Image With Preserving the Form of Shapes?

Best Linux Desktop Software Awards per Category for 2017!

Interactive Viewer in Flutter

Real-time and video processing object detection using Tensorflow, OpenCV and Docker.

Stop Relying on Willpower — Do This Instead to Consistently Improve Your Coding Skills

Telematics Gateway with J1939 Data Logging powering predictive maintenance of Heavy-duty Trucks…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


More from Medium

DevOps Using AWS Tooling

How-to setup a HA/DR database in AWS? [1]

Your first project on AWS — ALB