I can't set up a new capacity provider or update an existing capacity provider for my Amazon Elastic Container Service (Amazon ECS) cluster.
Resolution
The following are common issues when you set up a new capacity provider or update an existing capacity provider for your ECS cluster:
You use the AWS CLI to create an AWS Auto Scaling group capacity provider and you receive errors
When you use the AWS CLI to create a capacity provider, review your AWS CloudTrail events to check for the CreateCapacityProvider API. The following are common CapacityProvider API errors:
- ClientException: These errors can be caused by a client action. The client action uses an action or resource on behalf of an AWS Identity and Access Management (IAM) user. But, the client action doesn't have the required permissions to use the action or resource. This error can also specify that an identifier isn't valid.
- UpdateInProgressException: You receive this error because there is already a current ECS container agent update in progress on the container instance that you specified. If the container agent disconnects when in a transitional stage, such as PENDING or STAGING, then the update can get stuck in that state. However, when the agent reconnects, the update resumes where it previously stopped.
For more information, see Errors.
Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshoot AWS CLI errors. Also, make sure that you're using the most recent AWS CLI version.
You receive the error: "The specified capacity provider already exists. To change the configuration of an existing capacity provider, update the capacity provider"
When you create the capacity provider, use a name that's different from the capacity provider names used previously. Or, delete the existing capacity provider with that name and then create a new capacity provider.
To view a list of all capacity providers created, run the describe-capacity-providers AWS CLI command:
aws ecs describe-capacity-providers --query capacityProviders\[\].name --region example-region
The output looks similar to the following:
[
"FARGATE",
"FARGATE_SPOT",
"ecs-capacityprovider-1"
]
To delete a capacity provider, run the delete-capacity-provider AWS CLI command:
aws ecs delete-capacity-provider --capacity-provider ecs-capacityprovider-1 --region example-region
To create a new capacity provider, run the create-capacity-provider AWS CLI command:
aws ecs create-capacity-provider --name "example-capacity=provider" --auto-scaling-group-provider "autoScalingGroupArn=arn:aws:autoscaling:us-east-1:123456789012:autoScalingGroup:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:autoScalingGroupName/MyAutoScalingGroup,managedScaling={status=ENABLED,targetCapacity=100,minimumScalingStepSize=1,maximumScalingStepSize=100},managedTerminationProtection=ENABLED"
You receive the error: "The specified Auto Scaling group ARN is already being used by another capacity provider. Specify a unique Auto Scaling group ARN and try again"
The AWS Auto Scaling group and capacity provider must have a one-to-one relationship. Confirm that your capacity provider is associated with only one AWS Auto Scaling group. Confirm that the group is associated with only one capacity provider.
You create the capacity provider strategy and receive the error: "The specified cluster is in a busy state. Cluster attachments must be in UPDATE_COMPLETE or UPDATE_FAILED state before they can be updated. Wait and try again"
This error auto resolves after several minutes. After the error resolves, try to update the capacity provider again. Or, run the describe-clusters AWS CLI command to view the current status of the attachments. Then, wait until the attachment is in the UPDATE_COMPLETE status:
aws ecs describe-clusters --clusters example-ARN --include ATTACHMENTS --query clusters\[\].attachmentsStatus --region example-region
A completed update status output looks similar to the following:
[
"UPDATE_COMPLETE"
]
You receive errors because of limitations with the capacity provider
Confirm that your capacity provider meets the following:
- You can't specify more than six capacity providers for a capacity strategy.
- Use either AWS Auto Scaling group capacity providers or AWS Fargate capacity providers in your cluster strategy. You can't use a combination of both types.
- The base value for the capacity provider strategy is supported only when you run the tasks.
The capacity provider is created successfully with CloudFormation, but it isn't shown in the console
This occurs when you don't associate the capacity provider with the cluster in your AWS CloudFormation template. To avoid this issue, use the following snippet in your CloudFormation template to associate the capacity provider with the cluster:
...
ECSCluster:
Type: 'AWS::ECS::Cluster'
Properties:
ClusterName: example-cluster
CapacityProviders:
- !Ref ECSCapacityProvider
...
Related information
Amazon ECS capacity providers for the EC2 launch type
How do I resolve the DELETE_FAILED error when deleting the capacity provider in Amazon ECS?