CmdID

CmdID / aws / aws ecs

aws ecs create-cluster

Creates a new Amazon ECS cluster. AWS CLI reference

3 examples 7 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

Example 1: To create a new cluster

The following create-cluster example creates a cluster named MyCluster and enables CloudWatch Container Insights with enhanced observability.

aws ecs create-cluster --cluster-name MyCluster --settings name=containerInsights,value=enhancedIdentify
--cluster-nameThe name of your cluster.
--settingsThe setting to use when creating a cluster.
Its output
{
    "cluster": {
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
        "clusterName": "MyCluster",
        "status": "ACTIVE",
        "registeredContainerInstancesCount": 0,
        "pendingTasksCount": 0,
        "runningTasksCount": 0,
        "activeServicesCount": 0,
        "statistics": [],
        "settings": [
            {
                "name": "containerInsights",
                "value": "enhanced"
            }
        ],
        "tags": []
    }
}

For more information, see Creating an Amazon ECS cluster for Fargate workloads in the Amazon ECS Developer Guide.

Example 2: To create a new cluster using capacity providers

The following create-cluster example creates a cluster and associates two existing capacity providers with it. The create-capacity-provider command is used to create a capacity provider. Specifying a default capacity provider strategy is optional, but recommended. In this example, we create a cluster named MyCluster and associate the MyCapacityProvider1 and MyCapacityProvider2 capacity providers with it. A default capacity provider strategy is specified that spreads the tasks evenly across both capacity providers.

aws ecs create-cluster --cluster-name MyCluster --capacity-providers MyCapacityProvider1 MyCapacityProvider2 --default-capacity-provider-strategy capacityProvider=MyCapacityProvider1,weight=1 capacityProvider=MyCapacityProvider2,weight=1Identify
--cluster-nameThe name of your cluster.
--capacity-providersThe short name of one or more capacity providers to associate with the cluster.
--default-capacity-provider-strategyThe capacity provider strategy to set as the default for the cluster.
Its output, shortened
{
    "cluster": {
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
        "clusterName": "MyCluster",
        "status": "PROVISIONING",
        "registeredContainerInstancesCount": 0,
        "pendingTasksCount": 0,
        "runningTasksCount": 0,
        "activeServicesCount": 0,
        "statistics": [],
        "settings": [
            {
                "name": "containerInsights",
                "value": "enabled"
            }
        ],
        "capacityProviders": [
            "MyCapacityProvider1",
            "MyCapacityProvider2"
        ],
        "defaultCapacityProviderStrategy": [
            {
                "capacityProvider": "MyCapacityProvider1",
                "weight": 1,
                "base": 0
            },
            {
                "capacityProvider": "MyCapacityProvider2",
                "weight": 1,
                "base": 0
… 37 more lines

For more information, see Amazon ECS capacity providers for EC2 workloads in the Amazon ECS Developer Guide.

Example 3: To create a new cluster with multiple tags

The following create-cluster example creates a cluster with multiple tags. For more information about adding tags using shorthand syntax, see Using Shorthand Syntax with the AWS Command Line Interface in the AWS CLI User Guide.

aws ecs create-cluster --cluster-name MyCluster --tags key=key1,value=value1 key=key2,value=value2Identify
--cluster-nameThe name of your cluster.
--tagsThe metadata that you apply to the cluster to help you categorize and organize them.
Its output
{
    "cluster": {
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
        "clusterName": "MyCluster",
        "status": "ACTIVE",
        "registeredContainerInstancesCount": 0,
        "pendingTasksCount": 0,
        "runningTasksCount": 0,
        "activeServicesCount": 0,
        "statistics": [],
        "tags": [
            {
                "key": "key1",
                "value": "value1"
            },
            {
                "key": "key2",
                "value": "value2"
            }
        ]
    }
}

For more information, see Creating an Amazon ECS cluster for Fargate workloads in the Amazon ECS Developer Guide.

Options

7 in the AWS CLI reference
--capacity-providersThe short name of one or more capacity providers to associate with the cluster.
--cluster-nameThe name of your cluster.
--configurationThe execute command configuration for the cluster.
--default-capacity-provider-strategyThe capacity provider strategy to set as the default for the cluster.
--service-connect-defaultsUse this parameter to set a default Service Connect namespace.
--settingsThe setting to use when creating a cluster.
--tagsThe metadata that you apply to the cluster to help you categorize and organize them.