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

Introduction to OS deadlock

Deploying Webapp on AWS using Terraform

How decentralised is your web3 platform? It’s important to know.

Ohno — save food save world

CS371p Fall 2020: Barrett Schonefeld

The Right Mobile App Development Stack for Robust Application

Why I would like to become a Software Engineer through Holberton School

How To Increment Versions For Maven Build Java Project — Part 2

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

Import your Cloud Resource as a Pro — Native way of doing Terraform !!!

Terraform AWS Provider — Default Tags

How-to setup a HA/DR database in AWS? [7 — Dynamic Terraform backend definition]

Ansible Dynamic Inventory AWS