AWS::ECS::CapacityProvider - Amazon CloudFormation
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).


Creates a new capacity provider. Capacity providers are associated with an Amazon ECS cluster and are used in capacity provider strategies to facilitate cluster auto scaling.

Only capacity providers that use an Auto Scaling group can be created. Amazon ECS tasks on Amazon Fargate use the FARGATE and FARGATE_SPOT capacity providers. These providers are available to all accounts in the Amazon Regions that Amazon Fargate supports.


To declare this entity in your Amazon CloudFormation template, use the following syntax:


{ "Type" : "AWS::ECS::CapacityProvider", "Properties" : { "AutoScalingGroupProvider" : AutoScalingGroupProvider, "Name" : String, "Tags" : [ Tag, ... ] } }


Type: AWS::ECS::CapacityProvider Properties: AutoScalingGroupProvider: AutoScalingGroupProvider Name: String Tags: - Tag



The Auto Scaling group settings for the capacity provider.

Required: Yes

Type: AutoScalingGroupProvider

Update requires: No interruption


The name of the capacity provider. If a name is specified, it cannot start with aws, ecs, or fargate. If no name is specified, a default name in the CFNStackName-CFNResourceName-RandomString format is used.

Required: No

Type: String

Update requires: Replacement


The metadata that you apply to the capacity provider to help you categorize and organize it. Each tag consists of a key and an optional value. You define both.

The following basic restrictions apply to tags:

  • Maximum number of tags per resource - 50

  • For each resource, each tag key must be unique, and each tag key can have only one value.

  • Maximum key length - 128 Unicode characters in UTF-8

  • Maximum value length - 256 Unicode characters in UTF-8

  • If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @.

  • Tag keys and values are case-sensitive.

  • Do not use aws:, AWS:, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for Amazon use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.

Required: No

Type: Array of Tag

Minimum: 0

Maximum: 50

Update requires: No interruption

Return values


When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the resource name.

In the following example, the Ref function returns the name of the capacity provider, such as MyStack-MyCapacityProvider-JrwYBzxovGfr.

{ "Ref": "MyCapacityProvider" }

For more information about using the Ref function, see Ref.


Creating an Amazon ECS capacity provider

The following example creates a capacity provider that uses the Auto Scaling group MyAutoScalingGroup, has managed scaling and managed termination protection enabled. This configuration is used for Amazon ECS cluster auto scaling.


{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "MyCapacityProvider": { "Type": "AWS::ECS::CapacityProvider", "Properties": { "AutoScalingGroupProvider": { "AutoScalingGroupArn": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:autoScalingGroupName/MyAutoScalingGroup", "ManagedScaling": { "MaximumScalingStepSize": 10, "MinimumScalingStepSize": 1, "Status": "ENABLED", "TargetCapacity": 100 }, "ManagedTerminationProtection": "ENABLED" }, "Tags": [ { "Key": "environment", "Value": "production" } ] } } } }


AWSTemplateFormatVersion: 2010-09-09 Resources: MyCapacityProvider: Type: AWS::ECS::CapacityProvider Properties: AutoScalingGroupProvider: AutoScalingGroupArn: arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:autoScalingGroupName/MyAutoScalingGroup ManagedScaling: MaximumScalingStepSize: 10 MinimumScalingStepSize: 1 Status: ENABLED TargetCapacity: 100 ManagedTerminationProtection: ENABLED Tags: - Key: environment Value: production