Interview Prep/AWS/EC2, Auto Scaling and Load Balancing

You updated the launch template with a new AMI, but new ASG instances still boot the old AMI.

BeginnerTroubleshootingEC2, Auto Scaling and Load Balancing
Answer

Likely causes → The ASG references a specific template version, or $Default, and you created a new version without making it the default. New versions are not used until the ASG points at them.

Diagnose →

aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names web-asg \
  --query 'AutoScalingGroups[].[LaunchTemplate,MixedInstancesPolicy.LaunchTemplate.LaunchTemplateSpecification]'
aws ec2 describe-launch-template-versions --launch-template-id lt-0abc \
  --query 'LaunchTemplateVersions[].[VersionNumber,DefaultVersion,LaunchTemplateData.ImageId]'

Fix →

  1. Point the ASG at $Latest, or set the new version as default: aws ec2 modify-launch-template --launch-template-id lt-0abc --default-version 7
  2. Start an instance refresh to replace the instances that are already running

Prevent → Have the pipeline create the version, update the ASG and start an instance refresh in one step.

aws All AWS questions Roadmap: AWS core services

More on EC2, Auto Scaling and Load Balancing