

# Troubleshoot issues in Amazon EC2 Auto Scaling
<a name="CHAP_Troubleshooting"></a>

Amazon EC2 Auto Scaling provides specific and descriptive errors to help you troubleshoot issues. You can find the error messages in the description of the scaling activities.

**Topics**
+ [Retrieve an error message from scaling activities](#RetrievingErrors)
+ [Turn off scaling activities](#turn-off-scaling-activities)
+ [Additional troubleshooting resources](#additional-troubleshooting-resources)
+ [Troubleshoot Amazon EC2 Auto Scaling: EC2 instance launch failures](ts-as-instancelaunchfailure.md)
+ [Troubleshoot Amazon EC2 Auto Scaling: AMI issues](ts-as-ami.md)
+ [Troubleshoot Amazon EC2 Auto Scaling: Load balancer issues](ts-as-loadbalancer.md)
+ [Troubleshoot Amazon EC2 Auto Scaling: Launch templates](ts-as-launch-template.md)

## Retrieve an error message from scaling activities
<a name="RetrievingErrors"></a>

To retrieve an error message from the description of scaling activities, use the [describe-scaling-activities](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-scaling-activities.html) command. You have a record of scaling activities that dates back 6 weeks. Scaling activities are ordered by start time, with the latest scaling activities listed first. 

**Note**  
The scaling activities are also displayed in the activity history in the Amazon EC2 Auto Scaling console on the **Activity** tab for the Auto Scaling group.

To see the scaling activities for a specific Auto Scaling group, use the following command. 

```
aws autoscaling describe-scaling-activities --auto-scaling-group-name my-asg
```

The following is an example response, where `StatusCode` contains the current status of the activity and `StatusMessage` contains the error message.

```
{
    "Activities": [
        {
            "ActivityId": "3b05dbf6-037c-b92f-133f-38275269dc0f",
            "AutoScalingGroupName": "my-asg",
            "Description": "Launching a new EC2 instance: i-003a5b3ffe1e9358e.  Status Reason: Instance failed to complete user's Lifecycle Action: Lifecycle Action with token e85eb647-4fe0-4909-b341-a6c42d8aba1f was abandoned: Lifecycle Action Completed with ABANDON Result",
            "Cause": "At 2021-01-11T00:35:52Z a user request created an AutoScalingGroup changing the desired capacity from 0 to 1.  At 2021-01-11T00:35:53Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 1.",
            "StartTime": "2021-01-11T00:35:55.542Z",
            "EndTime": "2021-01-11T01:06:31Z",
            "StatusCode": "Cancelled",
            "StatusMessage": "Instance failed to complete user's Lifecycle Action: Lifecycle Action with token e85eb647-4fe0-4909-b341-a6c42d8aba1f was abandoned: Lifecycle Action Completed with ABANDON Result",
            "Progress": 100,
            "Details": "{\"Subnet ID\":\"subnet-5ea0c127\",\"Availability Zone\":\"us-west-2b\"...}",
            "AutoScalingGroupARN": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:283179a2-f3ce-423d-93f6-66bb518232f7:autoScalingGroupName/my-asg"
        },
     ...
    ]
}
```

For a description of the fields in the output, see [Activity](https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_Activity.html) in the *Amazon EC2 Auto Scaling API Reference*.

**To view scaling activities for a deleted group**  
To view scaling activities after the Auto Scaling group has been deleted, add the `--include-deleted-groups` option to the [describe-scaling-activities](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-scaling-activities.html) command as follows. 

```
aws autoscaling describe-scaling-activities --auto-scaling-group-name my-asg --include-deleted-groups
```

The following is an example response, with a scaling activity for a deleted group. 

```
{
    "Activities": [
        {
            "ActivityId": "e1f5de0e-f93e-1417-34ac-092a76fba220",
            "AutoScalingGroupName": "my-asg",
            "Description": "Launching a new EC2 instance.  Status Reason: Your Spot request price of 0.001 is lower than the minimum required Spot request fulfillment price of 0.0031. Launching EC2 instance failed.",
            "Cause": "At 2021-01-13T20:47:24Z a user request update of AutoScalingGroup constraints to min: 1, max: 5, desired: 3 changing the desired capacity from 0 to 3.  At 2021-01-13T20:47:27Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 3.",
            "StartTime": "2021-01-13T20:47:30.094Z",
            "EndTime": "2021-01-13T20:47:30Z",
            "StatusCode": "Failed",
            "StatusMessage": "Your Spot request price of 0.001 is lower than the minimum required Spot request fulfillment price of 0.0031. Launching EC2 instance failed.",
            "Progress": 100,
            "Details": "{\"Subnet ID\":\"subnet-5ea0c127\",\"Availability Zone\":\"us-west-2b\"...}",
            "AutoScalingGroupState": "Deleted",
            "AutoScalingGroupARN": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:283179a2-f3ce-423d-93f6-66bb518232f7:autoScalingGroupName/my-asg"
        },
     ...
    ]
}
```

## Turn off scaling activities
<a name="turn-off-scaling-activities"></a>

You have the following options if you need to investigate an issue without interference from scaling policies or scheduled actions:
+ Prevent all dynamic scaling policies and scheduled actions from making changes to the group's desired capacity by suspending the `AlarmNotification` and `ScheduledActions` processes. For more information, see [Suspend and resume Amazon EC2 Auto Scaling processes](as-suspend-resume-processes.md).
+ Disable individual dynamic scaling policies so that they don't change the group's desired capacity in response to changes in load. For more information, see [Disable a scaling policy for an Auto Scaling group](as-enable-disable-scaling-policy.md).
+ Update individual target tracking scaling policies to only scale out (add capacity) by disabling the policy's scale-in portion. This method prevents the group's desired capacity from shrinking but allows it to be increased when load increases. For more information, see [Target tracking scaling policies for Amazon EC2 Auto Scaling](as-scaling-target-tracking.md).
+ Update your predictive scaling policy to *forecast only* mode. While in forecast only mode, predictive scaling will continue to generate forecasts, but it will not automatically increase capacity. For more information, see [Create a predictive scaling policy for an Auto Scaling group](predictive-scaling-create-policy.md).

## Additional troubleshooting resources
<a name="additional-troubleshooting-resources"></a>

The following pages provide additional information for troubleshooting issues with Amazon EC2 Auto Scaling.
+ [Verify a scaling activity for an Auto Scaling group](as-verify-scaling-activity.md) 
+ [View monitoring graphs in the Amazon EC2 Auto Scaling console](viewing-monitoring-graphs.md) 
+ [Health checks for instances in an Auto Scaling group](ec2-auto-scaling-health-checks.md) 
+ [Considerations and limitations for lifecycle hooksConsiderations and limitations](lifecycle-hooks.md#lifecycle-hook-considerations)
+  [Complete a lifecycle action in an Auto Scaling group](completing-lifecycle-hooks.md)
+  [Provide network connectivity for your Auto Scaling instances using Amazon VPC](asg-in-vpc.md) 
+ [Temporarily remove instances from your Auto Scaling group](as-enter-exit-standby.md) 
+ [Disable a scaling policy for an Auto Scaling group](as-enable-disable-scaling-policy.md) 
+  [Suspend and resume Amazon EC2 Auto Scaling processes](as-suspend-resume-processes.md) 
+ [Control which Auto Scaling instances terminate during scale in](as-instance-termination.md) 
+ [Delete your Auto Scaling infrastructure](as-process-shutdown.md) 
+ [Quotas for Auto Scaling resources and groups](ec2-auto-scaling-quotas.md) 

The following AWS resources can also be of help:
+ [Amazon EC2 Auto Scaling topics in the AWS Knowledge Center](https://repost.aws/knowledge-center) 
+ [Amazon EC2 Auto Scaling questions on AWS re:Post](https://repost.aws/tags/TA5Ef3s6KtTiqT0mCRhR79ig/amazon-ec2-auto-scaling)
+ [Amazon EC2 Auto Scaling posts in the AWS Compute Blog](https://aws.amazon.com/blogs/compute/category/compute/auto-scaling/) 
+ [Troubleshooting CloudFormation in the *CloudFormation User Guide*](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/troubleshooting.html) 

Troubleshooting often requires iterative query and discovery by an expert or from a community of helpers. If you continue to experience issues after trying the suggestions in this section, contact AWS Support (in the AWS Management Console, click **Support**, **Support Center**) or ask a question on [AWS re:Post](https://repost.aws/) using the **Amazon EC2 Auto Scaling** tag.

# Troubleshoot Amazon EC2 Auto Scaling: EC2 instance launch failures
<a name="ts-as-instancelaunchfailure"></a>

This page provides information about your EC2 instances that fail to launch, potential causes, and the steps you can take to resolve the issues.

To retrieve an error message, see [Retrieve an error message from scaling activities](CHAP_Troubleshooting.md#RetrievingErrors).

When your EC2 instances fail to launch, you might get one or more of the following error messages:

**Topics**
+ [The requested configuration is currently not supported.](#ts-as-instancelaunchfailure-3)
+ [The security group <name of the security group> does not exist. Launching EC2 instance failed.](#ts-as-instancelaunchfailure-1)
+ [The key pair <key pair associated with your EC2 instance> does not exist. Launching EC2 instance failed.](#ts-as-instancelaunchfailure-2)
+ [Your requested instance type (<instance type>) is not supported in your requested Availability Zone (<instance Availability Zone>)...](#ts-as-instancelaunchfailure-6)
+ [Your Spot request price of 0.015 is lower than the minimum required Spot request fulfillment price of 0.0735...](#ts-as-instancelaunchfailure-7)
+ [Invalid device name <device name> / Invalid device name upload. Launching EC2 instance failed.](#ts-as-instancelaunchfailure-8)
+ [Value (<name associated with the instance storage device>) for parameter virtualName is invalid... Launching EC2 instance failed.](#ts-as-instancelaunchfailure-9)
+ [EBS block device mappings not supported for instance-store AMIs.](#ts-as-instancelaunchfailure-10)
+ [Placement groups may not be used with instances of type '<instance type>'. Launching EC2 instance failed.](#ts-as-instancelaunchfailure-11)
+ [Client.InternalError: Client error on launch.](#ts-as-instancelaunchfailure-12)
+ [We currently do not have sufficient <instance type> capacity in the Availability Zone you requested... Launching EC2 instance failed.](#ts-as-capacity-1)
+ [The requested reservation does not have sufficient compatible and available capacity for this request. Launching EC2 instance failed.](#ts-as-capacity-4)
+ [Your Capacity Block reservation <reservation id> is not active yet. Launching EC2 instance failed.](#ts-as-capacity-5)
+ [There is no Spot capacity available that matches your request. Launching EC2 instance failed.](#ts-as-capacity-2)
+ [<number of instances> instance(s) are already running. Launching EC2 instance failed.](#ts-as-capacity-3)

## The requested configuration is currently not supported.
<a name="ts-as-instancelaunchfailure-3"></a>

**Cause**: Some options in your launch template or launch configuration might not be compatible with the instance type, or the instance configuration might not be supported in your requested AWS Region or Availability Zones.

**Solution**: Try a different instance configuration. To search for an instance type that meets your requirements, see [Finding an Amazon EC2 instance type](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-discovery.html) in the *Amazon EC2 User Guide*. 

For further guidance to resolve this issue, check the following:
+ Ensure that you have chosen an AMI that is supported by your instance type. For example, if the instance type uses an Arm-based AWS Graviton processor instead of an Intel Xeon processor, you need an Arm-compatible AMI. For more information about choosing a compatible instance type, see [Compatibility for changing the instance type](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resize-limitations.html) in the *Amazon EC2 User Guide*.
+ Test that the instance type is available in your requested Region and Availability Zones. The newest generation instance types might not yet be available in a given Region or Availability Zone. The older generation instance types might not be available in newer Regions and Availability Zones. To search for instance types offered by location (Region or Availability Zone), use the [describe-instance-type-offerings](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-instance-type-offerings.html) command. For more information, see [Finding an Amazon EC2 instance type](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-discovery.html) in the *Amazon EC2 User Guide*. 
+ If you use Dedicated Instances or Dedicated Hosts, ensure that you have chosen an instance type that's supported as a Dedicated Instance or Dedicated Host. 

## The security group <name of the security group> does not exist. Launching EC2 instance failed.
<a name="ts-as-instancelaunchfailure-1"></a>

**Cause**: The security group specified in your launch template or launch configuration might have been deleted. 

**Solution**: 

1. Use the [describe-security-groups](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-security-groups.html) command to get the list of the security groups associated with your account.

1. From the list, select the security groups to use. To create a security group instead, use the [create-security-group](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/create-security-group.html) command.

1. Create a new launch template or launch configuration.

1. Update your Auto Scaling group with the new launch template or launch configuration using the [update-auto-scaling-group](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/update-auto-scaling-group.html) command.

## The key pair <key pair associated with your EC2 instance> does not exist. Launching EC2 instance failed.
<a name="ts-as-instancelaunchfailure-2"></a>

**Cause**: The key pair that was used when launching the instance might have been deleted.

**Solution**: 

1. Use the [describe-key-pairs](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-key-pairs.html) command to get the list of the key pairs available to you.

1. From the list, select the key pair to use. To create a key pair instead, use the [create-key-pair](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/create-key-pair.html) command.

1. Create a new launch template or launch configuration.

1. Update your Auto Scaling group with the new launch template or launch configuration using the [update-auto-scaling-group](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/update-auto-scaling-group.html) command.

## Your requested instance type (<instance type>) is not supported in your requested Availability Zone (<instance Availability Zone>)...
<a name="ts-as-instancelaunchfailure-6"></a>

**Error message**: Your requested instance type (<instance type>) is not supported in your requested Availability Zone (<instance Availability Zone>)...Launching EC2 instance failed.

**Cause**: The Availability Zones specified in your Auto Scaling group don't support your chosen instance type.

**Solution**: 

1. Verify which Availability Zones support your chosen instance type using the [describe-instance-type-offerings](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-instance-type-offerings.html) command or from the Amazon EC2 console by checking the **Availability Zones** value on the networking pane of the **Instance types** page.

1. Update or remove the subnet for any unsupported zones in the settings of your Auto Scaling group using the [update-auto-scaling-group](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/update-auto-scaling-group.html) command. For more information, see [Add an Availability ZoneRemove an Availability Zone](as-add-az-console.md).

## Your Spot request price of 0.015 is lower than the minimum required Spot request fulfillment price of 0.0735...
<a name="ts-as-instancelaunchfailure-7"></a>

**Cause**: The Spot maximum price in your request is lower than the Spot price for the instance type that you selected. 

**Solution**: Submit a new request with a higher Spot maximum price (possibly the On-Demand price). Previously, the Spot price you paid was based on bidding. Today, you pay the current Spot price. By setting your maximum price higher, it gives the Amazon EC2 Spot service a better chance of launching and maintaining your required amount of capacity.

## Invalid device name <device name> / Invalid device name upload. Launching EC2 instance failed.
<a name="ts-as-instancelaunchfailure-8"></a>

**Cause 1**: The block device mappings in your launch template or launch configuration might contain block device names that are not available or currently not supported. 

**Solution**: 

1. Verify which device names are available for your specific instance configuration. For more details on device naming, see [Device names on Linux instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html) in the *Amazon EC2 User Guide*.

1. Manually create an Amazon EC2 instance that is not part of the Auto Scaling group and investigate the problem. If the block device naming configuration conflicts with the names in the Amazon Machine Image (AMI), the instance will fail during launch. For more information, see [Block device mappings](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html) in the *Amazon EC2 User Guide*. 

1. After you confirm that your instance launched successfully, use the [describe-volumes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-volumes.html) command to see how the volumes are exposed to the instance.

1. Create a new launch template or launch configuration using the device name listed in the volume description.

1. Update your Auto Scaling group with the new launch template or launch configuration using the [update-auto-scaling-group](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/update-auto-scaling-group.html) command.

## Value (<name associated with the instance storage device>) for parameter virtualName is invalid... Launching EC2 instance failed.
<a name="ts-as-instancelaunchfailure-9"></a>

**Cause**: The format specified for the virtual name associated with the block device is incorrect. 

**Solution**:

1. Create a new launch template or launch configuration by specifying the device name in the `virtualName` parameter. For information about the device name format, see [Device naming on Linux instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html) in the *Amazon EC2 User Guide*.

1. Update your Auto Scaling group with the new launch template or launch configuration using the [update-auto-scaling-group](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/update-auto-scaling-group.html) command.

## EBS block device mappings not supported for instance-store AMIs.
<a name="ts-as-instancelaunchfailure-10"></a>

**Cause**: The block device mappings specified in the launch template or launch configuration are not supported on your instance. 

**Solution**:

1. Create a new launch template or launch configuration with block device mappings supported by your instance type. For more information, see [Block device mapping](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html) in the *Amazon EC2 User Guide*.

1. Update your Auto Scaling group with the new launch template or launch configuration using the [update-auto-scaling-group](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/update-auto-scaling-group.html) command.

## Placement groups may not be used with instances of type '<instance type>'. Launching EC2 instance failed.
<a name="ts-as-instancelaunchfailure-11"></a>

**Cause**: Your cluster placement group contains an invalid instance type. 

**Solution**: 

1. For information about valid instance types supported by the placement groups, see [Placement groups](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html) in the *Amazon EC2 User Guide*.

1. Follow the instructions detailed in the [Placement groups](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html) to create a new placement group.

1.  Alternatively, create a new launch template or launch configuration with the supported instance type. 

1. Update your Auto Scaling group with a new placement group, launch template, or launch configuration using the [update-auto-scaling-group](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/update-auto-scaling-group.html) command.

## Client.InternalError: Client error on launch.
<a name="ts-as-instancelaunchfailure-12"></a>

**Problem**: Amazon EC2 Auto Scaling tries to launch an instance that has an encrypted EBS volume, but the service-linked role does not have access to the AWS KMS customer managed key used to encrypt it. For more information, see [Required AWS KMS key policy for use with encrypted volumes](key-policy-requirements-EBS-encryption.md).

**Cause 1**: You need a key policy that gives permission to use the customer managed key to the proper service-linked role.

**Solution 1**: Allow the service-linked role to use the customer managed key as follows:

1. Determine which service-linked role to use for this Auto Scaling group.

1. Update the key policy on the customer managed key and allow the service-linked role to use the customer managed key.

1. Update the Auto Scaling group to use the service-linked role.

For an example of a key policy that lets the service-linked role use the customer managed key, see [Example 1: Key policy sections that allow access to the customer managed key](key-policy-requirements-EBS-encryption.md#policy-example-cmk-access).

**Cause 2**: If the customer managed key and Auto Scaling group are in *different* AWS accounts, you need to configure cross-account access to the customer managed key in order to give permission to use the customer managed key to the proper service-linked role. 

**Solution 2**: Allow the service-linked role in the external account to use the customer managed key in the local account as follows:

1. Update the key policy on the customer managed key to allow the Auto Scaling group account access to the customer managed key.

1. Define an IAM user or role in the Auto Scaling group account that can create a grant.

1. Determine which service-linked role to use for this Auto Scaling group.

1. Create a grant to the customer managed key with the proper service-linked role as the grantee principal.

1. Update the Auto Scaling group to use the service-linked role.

For more information, see [Example 2: Key policy sections that allow cross-account access to the customer managed key](key-policy-requirements-EBS-encryption.md#policy-example-cmk-cross-account-access).

**Solution 3**: Use a customer managed key in the same AWS account as the Auto Scaling group.

1. Copy and re-encrypt the snapshot with another customer managed key that belongs to the same account as the Auto Scaling group.

1. Allow the service-linked role to use the new customer managed key. See the steps for Solution 1.

## We currently do not have sufficient <instance type> capacity in the Availability Zone you requested... Launching EC2 instance failed.
<a name="ts-as-capacity-1"></a>

**Error message**: We currently do not have sufficient <instance type> capacity in the Availability Zone you requested (<requested Availability Zone>). Our system will be working on provisioning additional capacity. You can currently get <instance type> capacity by not specifying an Availability Zone in your request or choosing <list of Availability Zones that currently supports the instance type>. Launching EC2 instance failed.

**Cause**: At this time, the requested instance type and Availability Zone combination isn't supported.

**Solution**: To resolve the issue, try the following:
+ Wait a few minutes for Amazon EC2 Auto Scaling to find capacity for this instance type in other enabled Availability Zones.
+ Expand your Auto Scaling group to additional Availability Zones. For more information, see [Add an Availability ZoneRemove an Availability Zone](as-add-az-console.md). 
+ Follow the best practice of using a diverse set of instance types so that you're not reliant on one specific instance type. For more information, see [Auto Scaling groups with multiple instance types and purchase options](ec2-auto-scaling-mixed-instances-groups.md). 

## The requested reservation does not have sufficient compatible and available capacity for this request. Launching EC2 instance failed.
<a name="ts-as-capacity-4"></a>

**Cause 1**: You've reached the limit on the number of instances that you can launch with a `targeted` On-Demand Capacity Reservation. 

**Solution 1**: Either increase the number of instances that you can launch with the `targeted` On-Demand Capacity Reservation, or use a Capacity Reservations group so that anything beyond the reserved capacity will launch as regular On-Demand capacity. For more information, see [Reserve capacity in specific Availability Zones with Capacity Reservations](use-ec2-capacity-reservations.md). 

**Cause 2**: You've reached the limit on the number of instances that you can launch with a Capacity Block. 

With Capacity Blocks, you are constrained by the amount of capacity originally purchased. If you experience a higher number of launches than anticipated and use up all the capacity that you have available, this causes launches to fail. Terminating instances go through a lengthy clean up process before they're fully terminated. During this time, they can't be reused. This can also cause launches to fail. For more information, see [Use Capacity Blocks for machine learning workloads](launch-template-capacity-blocks.md).

**Solution 2**: To resolve the issue, try the following:
+ Keep the request as is. If a Capacity Block instance is terminating, you must wait several minutes for the instance to finish terminating and capacity to become available again. Amazon EC2 Auto Scaling continues to automatically make the launch request until capacity becomes available.
+ Make sure that you purchase sufficient capacity to accommodate your peak workload so that you do not encounter this error frequently.

## Your Capacity Block reservation <reservation id> is not active yet. Launching EC2 instance failed.
<a name="ts-as-capacity-5"></a>

**Cause**: The specified Capacity Block is not active yet.

**Solution**: Follow the recommended approach for Capacity Blocks and use scheduled scaling. Doing so helps you make sure you increase the desired capacity of your Auto Scaling group only when the reservation is active and decrease it before the reservation is over. 

## There is no Spot capacity available that matches your request. Launching EC2 instance failed.
<a name="ts-as-capacity-2"></a>

**Cause**: At this time, there isn't enough spare capacity to fulfill your request for Spot Instances. 

**Solution**: To resolve the issue, try the following:
+ Wait a few minutes; capacity can shift frequently. Amazon EC2 Auto Scaling continues to automatically make the launch request until capacity becomes available.
+ Expand your Auto Scaling group to additional Availability Zones. For more information, see [Add an Availability ZoneRemove an Availability Zone](as-add-az-console.md). 
+ Follow the best practice of using a diverse set of instance types so that you're not reliant on one specific instance type. For more information, see [Auto Scaling groups with multiple instance types and purchase options](ec2-auto-scaling-mixed-instances-groups.md). 

## <number of instances> instance(s) are already running. Launching EC2 instance failed.
<a name="ts-as-capacity-3"></a>

**Cause**: You have reached the limit on the number of instances that you can launch in a Region. When you create your AWS account, we set default limits on the number of instances you can run on a per-Region basis. 

**Solution**: To resolve the issue, try the following:
+ If your current limits aren't adequate for your needs, you can request a quota increase on a per-Region basis. For more information, see [Amazon EC2 service quotas](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-resource-limits.html) in the *Amazon EC2 User Guide*.
+ Submit a new request with a reduced number of instances (which you can increase at a later stage).

# Troubleshoot Amazon EC2 Auto Scaling: AMI issues
<a name="ts-as-ami"></a>

This page provides information about the issues associated with your AMIs, potential causes, and the steps you can take to resolve the issues.

To retrieve an error message, see [Retrieve an error message from scaling activities](CHAP_Troubleshooting.md#RetrievingErrors).

When your EC2 instances fail to launch due to issues with your AMI, you might get one or more of the following error messages.

**Topics**
+ [The AMI ID <ID of your AMI> does not exist. Launching EC2 instance failed.](#ts-as-ami-1)
+ [AMI <AMI ID> is pending, and cannot be run. Launching EC2 instance failed.](#ts-as-ami-2)
+ [Invalid device name <device name>. Launching EC2 instance failed.](#ts-as-ami-4)
+ [The architecture 'arm64 ' of the specified instance type does not match the architecture 'x86\$164' of the specified AMI...Launching EC2 instance failed.](#ts-as-ami-5)
+ [AMI '<AMI ID>' is disabled, and cannot be run. Launching EC2 instance failed.](#ts-disabled-ami-error)

**Important**  
AWS supports sharing an AMI privately with another AWS account by modifying the AMI permissions. If an AMI is made private without being shared, this can result in an authorization error when launching new instances. For more information about sharing private AMIs, see [Share an AMI with specific AWS accounts](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sharingamis-explicit.html) in the *Amazon EC2 User Guide*.

## The AMI ID <ID of your AMI> does not exist. Launching EC2 instance failed.
<a name="ts-as-ami-1"></a>
+ **Cause**: The AMI might have been deleted after creating the launch template or launch configuration.
+ **Solution**: 

  1. Create a new launch template or launch configuration using a valid AMI.

  1. Update your Auto Scaling group with the new launch template or launch configuration using the [update-auto-scaling-group](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/update-auto-scaling-group.html) command.

## AMI <AMI ID> is pending, and cannot be run. Launching EC2 instance failed.
<a name="ts-as-ami-2"></a>

**Cause**: You might have just created your AMI (by taking a snapshot of a running instance or any other way), and it might not be available yet. 

**Solution**: You must wait for your AMI to be available and then create your launch template or launch configuration. 

## Invalid device name <device name>. Launching EC2 instance failed.
<a name="ts-as-ami-4"></a>

**Cause**: When attaching an EBS volume to an EC2 instance, you must provide a valid device name for the volume. The selected AMI must support this device name.

**Solution**:

1. Create a new launch template or launch configuration and specify the correct device name for your AMI. The recommended naming convention varies based on the virtualization type of the AMI. For more information, see [Device names](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html) in the *Amazon EC2 User Guide*.

1. Update your Auto Scaling group with the new launch template or launch configuration using the [update-auto-scaling-group](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/update-auto-scaling-group.html) command.

## The architecture 'arm64 ' of the specified instance type does not match the architecture 'x86\$164' of the specified AMI...Launching EC2 instance failed.
<a name="ts-as-ami-5"></a>

**Cause 1**: If the architecture of the AMI and the instance type used in your launch template or launch configuration are not the same, you get an error when Amazon EC2 Auto Scaling tries to launch an instance using the incompatible instance configuration. 

**Solution 1**:

1. Verify the architecture of your AMI using the [describe-images](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-images.html) command or from the Amazon EC2 console by checking the **Architecture** value on the details pane of the **Amazon Machine Images (AMIs)** page.

1. Find an instance type that has the same architecture as your AMI using the [describe-instance-types](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-instance-types.html) command or from the Amazon EC2 console by checking the **Architecture** column on the **Instance types** screen. For more information about choosing a compatible instance type, see [Compatibility for changing the instance type](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resize-limitations.html) in the *Amazon EC2 User Guide*.

1. Create a new launch template or launch configuration using an instance type that has the same architecture as your AMI.

1. Update your Auto Scaling group with the new launch template or launch configuration using the [update-auto-scaling-group](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/update-auto-scaling-group.html) command.

**Cause 2**: Amazon EC2 Auto Scaling tries to launch an instance type that's specified in the mixed instances policy for your Auto Scaling group, but the instance type does not have the same architecture as the AMI specified in your launch template.

**Solution 1**: Do not include instance types that have different architectures in your mixed instances policy.

1. Verify the architecture of your AMI using the [describe-images](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-images.html) command or from the Amazon EC2 console by checking the **Architecture** value on the details pane of the **Amazon Machine Images (AMIs)** page.

1. Verify the architecture of each instance type that you intend to include in your mixed instances policy using the [describe-instance-types](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-instance-types.html) command or from the Amazon EC2 console by checking the **Architecture** column on the **Instance types** screen. For more information about choosing compatible instance types, see [Compatibility for changing the instance type](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resize-limitations.html) in the *Amazon EC2 User Guide*.

1. Update or remove the incompatible instance types from your Auto Scaling group using the [update-auto-scaling-group](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/update-auto-scaling-group.html) command.

**Solution 2**: To launch both Arm (Graviton2) and x86\$164 (Intel) instances in the same Auto Scaling group, you must use launch templates supported by an Arm-compatible AMI and an Intel x86-compatible AMI, respectively, to match the instance types in your mixed instances policy.

1. Verify the architecture of the AMI in your existing launch template using the [describe-images](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-images.html) command or from the Amazon EC2 console by checking the **Architecture** value on the details pane of the **Amazon Machine Images (AMIs)** page.

1. Create a new launch template using an AMI that matches the other architecture you intend to use.

1. Update your Auto Scaling group to override the existing launch template and specify the new launch template for each compatible instance type using the [update-auto-scaling-group](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/update-auto-scaling-group.html) command. For more information, see [Use multiple launch templates](ec2-auto-scaling-mixed-instances-groups-launch-template-overrides.md).

## AMI '<AMI ID>' is disabled, and cannot be run. Launching EC2 instance failed.
<a name="ts-disabled-ami-error"></a>

**Cause**: You are attempting to launch instances from an AMI that has been disabled. For more information, see [Disable an AMI](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/disable-an-ami.html) in the *Amazon EC2 User Guide*.

**Solution**:

1. Create a new launch template or launch configuration and specify an AMI that is not disabled.

1. Update your Auto Scaling group with the new launch template or launch configuration using the [update-auto-scaling-group](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/update-auto-scaling-group.html) command.

# Troubleshoot Amazon EC2 Auto Scaling: Load balancer issues
<a name="ts-as-loadbalancer"></a>

This page provides information about issues caused by the load balancer associated with your Auto Scaling group, potential causes, and the steps you can take to resolve the issues.

To retrieve an error message, see [Retrieve an error message from scaling activities](CHAP_Troubleshooting.md#RetrievingErrors).

When your EC2 instances fail to launch due to issues with the load balancer associated with your Auto Scaling group, you might get one or more of the following error messages.

**Topics**
+ [One or more target groups not found. Validating load balancer configuration failed.](#ts-as-loadbalancer-1)
+ [Cannot find Load Balancer <your load balancer>. Validating load balancer configuration failed.](#ts-as-loadbalancer-2)
+ [There is no ACTIVE Load Balancer named <load balancer name>. Updating load balancer configuration failed.](#ts-as-loadbalancer-3)
+ [EC2 instance <instance ID> is not in VPC. Updating load balancer configuration failed.](#ts-as-loadbalancer-4)

**Note**  
You can use Reachability Analyzer to troubleshoot connectivity issues by checking whether instances in your Auto Scaling group are reachable through the load balancer. To learn about the different network misconfiguration issues that are automatically detected by Reachability Analyzer, see [Reachability Analyzer explanation codes](https://docs.aws.amazon.com/vpc/latest/reachability/explanation-codes.html) in the *Reachability Analyzer User Guide*.

## One or more target groups not found. Validating load balancer configuration failed.
<a name="ts-as-loadbalancer-1"></a>

**Problem**: When your Auto Scaling group launches instances, Amazon EC2 Auto Scaling tries to validate that the Elastic Load Balancing resources that are associated with the Auto Scaling group exist. When a target group cannot be found, the scaling activity fails, and you get the `One or more target groups not found. Validating load balancer configuration failed.` error.

**Cause 1**: A target group attached to your Auto Scaling group has been deleted.

**Solution 1**: You can either create a new Auto Scaling group without the target group or remove the unused target group from the Auto Scaling group by using the Amazon EC2 Auto Scaling console or the [detach-load-balancer-target-groups](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/detach-load-balancer-target-groups.html) command.

**Cause 2**: The target group exists, but there was an issue trying to specify the target group ARN when creating the Auto Scaling group. Resources are not created in the right order.

**Solution 2**: Create a new Auto Scaling group and specify the target group at the end.

## Cannot find Load Balancer <your load balancer>. Validating load balancer configuration failed.
<a name="ts-as-loadbalancer-2"></a>

**Problem**: When your Auto Scaling group launches instances, Amazon EC2 Auto Scaling tries to validate that the Elastic Load Balancing resources that are associated with the Auto Scaling group exist. When a Classic Load Balancer cannot be found, the scaling activity fails, and you get the `Cannot find Load Balancer <your load balancer>. Validating load balancer configuration failed.` error.

**Cause 1**: The Classic Load Balancer has been deleted.

**Solution 1**: You can either create a new Auto Scaling group without the load balancer or remove the unused load balancer from the Auto Scaling group by using the Amazon EC2 Auto Scaling console or the [detach-load-balancers](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/detach-load-balancers.html) command.

**Cause 2**: The Classic Load Balancer exists, but there was an issue trying to specify the load balancer name when creating the Auto Scaling group. Resources are not created in the right order.

**Solution 2**: Create a new Auto Scaling group and specify the load balancer name at the end.

## There is no ACTIVE Load Balancer named <load balancer name>. Updating load balancer configuration failed.
<a name="ts-as-loadbalancer-3"></a>

**Cause**: The specified load balancer might have been deleted.

**Solution**: You can either create a new load balancer and then create a new Auto Scaling group or create a new Auto Scaling group without the load balancer. 

## EC2 instance <instance ID> is not in VPC. Updating load balancer configuration failed.
<a name="ts-as-loadbalancer-4"></a>

**Cause**: The specified instance does not exist in the VPC.

**Solution**: You can either delete your load balancer associated with the instance or create a new Auto Scaling group.

# Troubleshoot Amazon EC2 Auto Scaling: Launch templates
<a name="ts-as-launch-template"></a>

Use the following information to help you diagnose and fix common issues that you might encounter when trying to specify a launch template for your Auto Scaling group.

**Can't launch instances**  
If you are unable to launch any instances with an already specified launch template, check the following for general troubleshooting: [Troubleshoot Amazon EC2 Auto Scaling: EC2 instance launch failures](ts-as-instancelaunchfailure.md).

## You must use a valid fully-formed launch template (invalid value)
<a name="ts-launch-template-invalid-error"></a>

**Problem**: When you try to specify a launch template for an Auto Scaling group, you get the `You must use a valid fully-formed launch template` error. You might encounter this error because the values in the launch template are only validated when an Auto Scaling group that is using the launch template is created or updated.

**Cause 1**: If you receive a `You must use a valid fully-formed launch template` error, then there are issues that cause Amazon EC2 Auto Scaling to consider something about the launch template not valid. This is a generic error that can have several different causes. 

**Solution 1**: Try the following steps to troubleshoot:

1. Pay attention to the second part of the error message to find more information. Following the `You must use a valid fully-formed launch template` error, see the more specific error message that identifies the issue that you will need to address.

1. If you are unable to find the cause, test your launch template with the [run-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/run-instances.html) command. Use the `--dry-run` option, as shown in the following example. This lets you reproduce the issue and can provide insights about its cause.

   ```
   aws ec2 run-instances --launch-template LaunchTemplateName=my-template,Version='1' --dry-run
   ```

1. If a value is not valid, verify that the specified resource exists and that it's correct. For example, when you specify an Amazon EC2 key pair, the resource must exist in your account and in the Region in which you are creating or updating your Auto Scaling group.

1. If expected information is missing, verify your settings and adjust the launch template as needed.

1. After making your changes, re-run the [run-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/run-instances.html) command with the `--dry-run` option to verify that your launch template uses valid values.

For more information, see [Create a launch template for an Auto Scaling group](create-launch-template.md).

## You are not authorized to use launch template (insufficient permissions)
<a name="ts-launch-template-unauthorized-error"></a>

**Problem**: When you try to specify a launch template for an Auto Scaling group, you get the `You are not authorized to use launch template` error. 

**Cause 1**: If you are attempting to use a launch template, and the IAM credentials that you are using do not have sufficient permissions, you receive an error that you're not authorized to use the launch template. 

**Solution 1**: To resolve the issue, try the following:
+ Verify that the IAM credentials that you are using to make the request has permissions to call the EC2 API actions you need, including the `ec2:RunInstances` action. If you specified any tags in your launch template, you must also have permission to use the `ec2:CreateTags` action.
+ Alternatively, verify that the IAM credentials that you are using to make the request is assigned the `AmazonEC2FullAccess` policy. This AWS managed policy grants full access to all Amazon EC2 resources and related services, including Amazon EC2 Auto Scaling, CloudWatch, and Elastic Load Balancing.

For more information about the permissions required to use launch templates, including example IAM policies, see [Control access to launch templates with IAM permissions](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/permissions-for-launch-templates.html) in the *Amazon EC2 User Guide*. For other example IAM policies, see [Control Amazon EC2 launch template usage in Auto Scaling groups](ec2-auto-scaling-launch-template-permissions.md).

**Cause 2**: If you are attempting to use a launch template that specifies an instance profile, you must have IAM permission to pass the IAM role that is associated with the instance profile.

**Solution 2**: Verify that the IAM credentials that you are using to make the request has the correct `iam:PassRole` permission to pass the specified role to the Amazon EC2 Auto Scaling service. For more information and an example IAM policy, see [IAM role for applications that run on Amazon EC2 instances](us-iam-role.md). For further troubleshooting topics related to instance profiles, see [Troubleshooting Amazon EC2 and IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_iam-ec2.html) in the *IAM User Guide*.

**Cause 3**: If you are attempting to use a launch template that specifies an AMI in another AWS account, and the AMI is private and not shared with the AWS account you are using, you receive an error that you're not authorized to use the launch template.

**Solution 3**: Verify that the permissions on the AMI include the account that you are using. For more information, see [Share an AMI with specific AWS accounts](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sharingamis-explicit.html) in the *Amazon EC2 User Guide*.