Introduction

EC2 launch templates store multiple versions of instance configurations. When an Auto Scaling group or instance launch uses an older version than expected, new instances don't have the latest AMI, security groups, or instance type configurations, causing inconsistencies in your infrastructure.

Symptoms

When launching instances with wrong template version:

```bash $ aws ec2 run-instances --launch-template LaunchTemplateId=lt-12345

Instances launched with AMI ami-old123 instead of ami-new456 Instance type t2.micro instead of expected t3.medium ```

In Auto Scaling group activity:

```bash $ aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name my-asg

"LaunchTemplate": { "LaunchTemplateId": "lt-12345", "Version": "5" # Using old version 5, latest is 10 } ```

New instances don't match expected configuration:

bash
Instance i-new123 has security group sg-old instead of sg-new
Missing IAM instance profile that was added in latest version

Common Causes

  1. 1.Auto Scaling group not updated - ASG still references old $Default or specific version
  2. 2.Default version not changed - New template version created but not set as default
  3. 3.Version number specified explicitly - Hardcoded version number in configuration
  4. 4.Template permissions - Different versions have different permissions
  5. 5.Rollback confusion - Previous rollback left stale version references
  6. 6.Multiple templates - Using wrong template ID entirely

Step-by-Step Fix

  1. 1.Check logs for specific error messages
  2. 2.Verify configuration settings
  3. 3.Test network connectivity
  4. 4.Review recent changes
  5. 5.Apply corrective action
  6. 6.Verify the fix

Step 1: List Launch Template Versions

```bash # Get all versions of a launch template aws ec2 describe-launch-template-versions --launch-template-id lt-12345

# Get specific version aws ec2 describe-launch-template-versions --launch-template-id lt-12345 --versions "10"

# Get the default version aws ec2 describe-launch-template-versions --launch-template-id lt-12345 --versions "$Default"

# Check latest version number aws ec2 describe-launch-templates --launch-template-id lt-12345 \ --query 'LaunchTemplates[*].[LatestVersionNumber,DefaultVersionNumber]' ```

Step 2: Check Auto Scaling Group Template Version

```bash # Get ASG launch template configuration aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name my-asg \ --query 'AutoScalingGroups[*].LaunchTemplate'

# Check for mixed instances policy aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name my-asg \ --query 'AutoScalingGroups[*].MixedInstancesPolicy.LaunchTemplate'

# List all ASGs using a specific template aws autoscaling describe-auto-scaling-groups \ --query 'AutoScalingGroups[?LaunchTemplate.LaunchTemplateId==lt-12345]' ```

Step 3: Update Auto Scaling Group to Latest Version

```bash # Update to specific version number aws autoscaling update-auto-scaling-group --auto-scaling-group-name my-asg \ --launch-template LaunchTemplateId=lt-12345,Version=10

# Update to always use latest version aws autoscaling update-auto-scaling-group --auto-scaling-group-name my-asg \ --launch-template LaunchTemplateId=lt-12345,Version='$Latest'

# Update to use default version aws autoscaling update-auto-scaling-group --auto-scaling-group-name my-asg \ --launch-template LaunchTemplateId=lt-12345,Version='$Default' ```

Step 4: Set Default Version for Launch Template

```bash # Set version 10 as the default aws ec2 modify-launch-template --launch-template-id lt-12345 --default-version 10

# Verify the change aws ec2 describe-launch-templates --launch-template-id lt-12345 \ --query 'LaunchTemplates[*].DefaultVersionNumber' ```

Note: $Default refers to the version set here, $Latest always refers to the newest version.

Step 5: Compare Version Configurations

```bash # Get configuration differences between versions aws ec2 describe-launch-template-versions --launch-template-id lt-12345 \ --versions "5,10" \ --query 'LaunchTemplateVersions[*].[VersionNumber,LaunchTemplateData.ImageId,LaunchTemplateData.InstanceType,LaunchTemplateData.SecurityGroupIds]'

# Compare specific fields OLD_VERSION=5 NEW_VERSION=10

aws ec2 describe-launch-template-versions --launch-template-id lt-12345 --versions "$OLD_VERSION" > old.json aws ec2 describe-launch-template-versions --launch-template-id lt-12345 --versions "$NEW_VERSION" > new.json

# Diff the configurations diff old.json new.json ```

Step 6: Create New Version with Corrected Configuration

```bash # Create new version based on existing version aws ec2 create-launch-template-version --launch-template-id lt-12345 \ --source-version 10 \ --launch-template-data '{"ImageId":"ami-new456","InstanceType":"t3.medium"}'

# Create version with specific changes aws ec2 create-launch-template-version --launch-template-id lt-12345 \ --launch-template-data '{ "ImageId": "ami-0abcdef1234567890", "InstanceType": "t3.medium", "SecurityGroupIds": ["sg-new123"], "IamInstanceProfile": {"Name": "my-profile"} }' ```

Step 7: Verify Instances Are Using Correct Version

```bash # Check instance launch template details aws ec2 describe-instances --instance-ids i-abc123 \ --query 'Reservations[*].Instances[*].LaunchTemplate'

# List all instances launched from specific template version aws ec2 describe-instances \ --filters Name=launch-template-id,Values=lt-12345 Name=launch-template-version,Values=5 \ --query 'Reservations[*].Instances[*].InstanceId'

# Find instances using old AMI (from old template version) aws ec2 describe-instances \ --filters Name=image-id,Values=ami-old123 \ --query 'Reservations[*].Instances[*].[InstanceId,LaunchTemplate]' ```

Step 8: Trigger Instance Refresh for Auto Scaling Group

To replace existing instances with new template version:

```bash # Start instance refresh aws autoscaling start-instance-refresh --auto-scaling-group-name my-asg \ --strategy Rolling \ --preferences '{"MinHealthyPercentage":90,"InstanceWarmup":60}'

# Check refresh status aws autoscaling describe-instance-refreshes --auto-scaling-group-name my-asg

# Cancel if needed aws autoscaling cancel-instance-refresh --auto-scaling-group-name my-asg ```

Step 9: Check for Template Version Deletion Issues

```bash # Cannot delete version if ASG references it aws ec2 delete-launch-template-versions --launch-template-id lt-12345 --versions "5"

# Error if version is in use: # "An error occurred (InvalidLaunchTemplateId.VersionInUse)"

# Check what's using the version aws autoscaling describe-auto-scaling-groups \ --query 'AutoScalingGroups[?LaunchTemplate.Version==5]' ```

Step 10: Audit Template Version References

bash # Find all resources referencing template versions aws ec2 describe-spot-fleet-requests \ --query 'SpotFleetRequestConfigs[?LaunchTemplateConfigs[?LaunchTemplateId==lt-12345`]]'

# Check EC2 Fleet aws ec2 describe-fleets \ --query 'Fleets[?LaunchTemplateConfigs[?LaunchTemplateId==lt-12345]]'

# Check RunInstances calls in CloudTrail aws cloudtrail lookup-events \ --lookup-attributes AttributeKey=ResourceName,AttributeValue=lt-12345 \ --max-items 20 ```

Verification

```bash # Launch test instance with template INSTANCE_ID=$(aws ec2 run-instances --launch-template LaunchTemplateId=lt-12345 \ --query 'Instances[0].InstanceId' --output text)

# Check instance configuration matches expected aws ec2 describe-instances --instance-ids $INSTANCE_ID \ --query 'Reservations[*].Instances[*].[ImageId,InstanceType,SecurityGroups[*].GroupId,IamInstanceProfile.Arn]'

# Terminate test instance aws ec2 terminate-instances --instance-ids $INSTANCE_ID ```

  • [Fix AWS Auto Scaling Not Triggering](/articles/fix-aws-auto-scaling-not-triggering)
  • [Fix AWS EC2 Instance Not Starting](/articles/fix-aws-ec2-instance-not-starting)
  • [Fix AWS EC2 Spot Instance Interrupted](/articles/fix-aws-ec2-spot-instance-interrupted)
  • [AWS troubleshooting: Fix IAM Permission Denied - Complete Tro](fix-iam-permission-denied)
  • [AWS cloud troubleshooting: AWS ACM Certificate Pending Validation Because the](aws-acm-certificate-pending-validation-wrong-route53-zone)
  • [AWS cloud troubleshooting: AWS ALB Returns 502 Because the Target Closed the ](aws-alb-502-target-closed-connection-keepalive-timeout-mismatch)
  • [AWS cloud troubleshooting: Fix AWS ALB CreateListener TargetGroupNotFound Err](aws-alb-createlistener-targetgroupnotfound)
  • [AWS cloud troubleshooting: Fix Aws Alb Lambda 502 Bad Gateway Issue in AWS](aws-alb-lambda-502-bad-gateway)

<script type="application/ld+json"> { "@context": "https://schema.org", "@type": "TechArticle", "headline": "Fix AWS EC2 Launch Template Version Wrong", "description": "Troubleshoot EC2 launch template version issues. Fix Auto Scaling group version mismatches, template defaults, and version management.", "url": "https://www.fixwikihub.com/fix-aws-ec2-launch-template-version-wrong", "publisher": { "@type": "Organization", "name": "FixWikiHub", "url": "https://www.fixwikihub.com" }, "author": { "@type": "Person", "name": "FixWikiHub Editorial Team" }, "datePublished": "2026-04-01T08:51:18.575Z", "dateModified": "2026-04-01T08:51:18.575Z" } </script>