AWS::ECS::Cluster - AWS CloudFormation


The AWS::ECS::Cluster resource creates an Amazon Elastic Container Service (Amazon ECS) cluster.


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


{ "Type" : "AWS::ECS::Cluster", "Properties" : { "CapacityProviders" : [ String, ... ], "ClusterName" : String, "ClusterSettings" : [ ClusterSettings, ... ], "DefaultCapacityProviderStrategy" : [ CapacityProviderStrategyItem, ... ], "Tags" : [ Tag, ... ] } }



The capacity providers associated with the cluster.

Required: No

Type: List of String

Update requires: No interruption


A user-generated string that you use to identify your cluster. If you don't specify a name, AWS CloudFormation generates a unique physical ID for the name.

Required: No

Type: String

Update requires: Replacement


The setting to use when creating a cluster. This parameter is used to enable CloudWatch Container Insights for a cluster. If this value is specified, it will override the containerInsights value set with PutAccountSetting or PutAccountSettingDefault.

Required: No

Type: List of ClusterSettings

Update requires: No interruption


The default capacity provider strategy for the cluster. When services or tasks are run in the cluster with no launch type or capacity provider strategy specified, the default capacity provider strategy is used.

Required: No

Type: List of CapacityProviderStrategyItem

Update requires: No interruption


The metadata that you apply to the cluster to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.

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 AWS 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: List of Tag

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 MyECSCluster cluster, such as MyStack-MyECSCluster-NT5EUXTNTXXD.

{ "Ref": "MyECSCluster" }

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


The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.


The Amazon Resource Name (ARN) of the Amazon ECS cluster, such as arn:aws:ecs:us-east-2:123456789012:cluster/MyECSCluster.


Create an Amazon ECS cluster

The following example creates an empty cluster named MyCluster.


{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "MyCluster": { "Type": "AWS::ECS::Cluster", "Properties": { "ClusterName": "MyCluster" } } } }


AWSTemplateFormatVersion: 2010-09-09 Resources: MyCluster: Type: 'AWS::ECS::Cluster' Properties: ClusterName: MyCluster

Create an empty Amazon ECS cluster with CloudWatch Container Insights enabled and defined tags

The following example creates an empty cluster named MyCluster with CloudWatch Container Insights enabled that is tagged with the key environment and the value production.


{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "ECSCluster": { "Type": "AWS::ECS::Cluster", "Properties": { "ClusterName": "MyCluster", "ClusterSettings": [ { "Name": "containerInsights", "Value": "enabled" } ], "Tags": [ { "Key": "environment", "Value": "production" } ] } } } }


AWSTemplateFormatVersion: 2010-09-09 Resources: ECSCluster: Type: 'AWS::ECS::Cluster' Properties: ClusterName: MyCluster ClusterSettings: - Name: containerInsights Value: enabled Tags: - Key: environment Value: production