Why can’t I launch an EC2 instance using a launch template?

3 minute read
0

My Amazon Elastic Compute Cloud (Amazon EC2) Auto Scaling group or AWS Identity and Access Management (IAM) user can't launch an EC2 instance using the launch template.

Resolution

Note: If you don't see an error code when launching the EC2 instance, review the AWS CloudTrail service event logs for the RunInstances API call. For an EC2 Auto Scaling group, review the scaling activity history to see the failure reason.

The following are common errors that prevent launching an instance from the EC2 launch template:

Not authorized for images

Error message

"Launching a new EC2 instance. Status Reason: Not authorized for images: [ami -0abcdef1234567890]. Launching EC2 instance failed."

This error indicates that you don't have access to the AMI. You can use public AMIs and private AMIs that are explicitly shared with you. Or, the error might indicate that the AMI was deleted after creating the launch template.

Resolution

1.    Verify that the AMI is available. For more information, see Find a Windows AMI or Find a Linux AMI.

2.    Update the EC2 launch template with a valid AMI.

3.    Update your Auto Scaling group with the new launch template or launch configuration using the update-auto-scaling-group command.

Client error on launch

Error message

"Client.InternalError: Client error on launch"

This error occurs if the IAM user or service-linked roles used by the EC2 Auto Scaling group doesn't have the correct permissions. The user or role must have access to the AWS Key Management Service (AWS KMS) customer managed key used to encrypt the AMI.

For more information, see the following:

Incompatible launch template

Error message

"Launching a new EC2 instance. Status Reason: Incompatible launch template: Each network interface requires a unique device index."

This error indicates an incorrect network interface device index value on the EC2 launch template. Two or more network interfaces might use the same device index number.

Resolution

1.    Review the limitations of changing the default network interface settings for EC2 launch templates.

2.    Create a new version of the launch template from an existing EC2 launch template.

3.    Under Network settings, expand Advanced network configuration.

4.    Specify the unique device index for each network interface.

5.    Run the update-auto-scaling-group AWS Command Line Interface (AWS CLI) command to update your Auto Scaling group with the new launch template or configuration

Note: If you receive errors when running AWS CLI commands, make sure that you're using the most recent version of the AWS CLI.

AWS OFFICIAL
AWS OFFICIALUpdated a year ago