Skip to main content

clusters

Creates, updates, deletes, gets or lists a clusters resource.

Overview

Nameclusters
TypeResource
Idaws.ecs.clusters

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
clustersarrayThe list of clusters.
failuresarrayAny failures associated with the call.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_clustersselectregionDescribes one or more of your clusters. For CLI examples, see describe-clusters.rst on GitHub.
create_clusterinsertregionCreates a new Amazon ECS cluster. By default, your account receives a default cluster when you launch your first container instance. However, you can create your own cluster with a unique name. When you call the CreateCluster API operation, Amazon ECS attempts to create the Amazon ECS service-linked role for your account. This is so that it can manage required resources in other Amazon Web Services services on your behalf. However, if the user that makes the call doesn't have permissions to create the service-linked role, it isn't created. For more information, see Using service-linked roles for Amazon ECS in the Amazon Elastic Container Service Developer Guide.
update_cluster_settingsupdateregion, cluster, settingsModifies the settings to use for a cluster.
update_clusterupdateregion, clusterUpdates the cluster.
delete_clusterdeleteregionDeletes the specified cluster. The cluster transitions to the INACTIVE state. Clusters with an INACTIVE status might remain discoverable in your account for a period of time. However, this behavior is subject to change in the future. We don't recommend that you rely on INACTIVE clusters persisting. You must deregister all container instances from this cluster before you may delete it. You can list the container instances in a cluster with ListContainerInstances and deregister them with DeregisterContainerInstance.
list_clustersexecregionReturns a list of existing clusters.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Describes one or more of your clusters. For CLI examples, see describe-clusters.rst on GitHub.

SELECT
clusters,
failures
FROM aws.ecs.clusters
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a new Amazon ECS cluster. By default, your account receives a default cluster when you launch your first container instance. However, you can create your own cluster with a unique name. When you call the CreateCluster API operation, Amazon ECS attempts to create the Amazon ECS service-linked role for your account. This is so that it can manage required resources in other Amazon Web Services services on your behalf. However, if the user that makes the call doesn't have permissions to create the service-linked role, it isn't created. For more information, see Using service-linked roles for Amazon ECS in the Amazon Elastic Container Service Developer Guide.

INSERT INTO aws.ecs.clusters (
clusterName,
tags,
settings,
configuration,
capacityProviders,
defaultCapacityProviderStrategy,
serviceConnectDefaults,
region
)
SELECT
'{{ clusterName }}',
'{{ tags }}',
'{{ settings }}',
'{{ configuration }}',
'{{ capacityProviders }}',
'{{ defaultCapacityProviderStrategy }}',
'{{ serviceConnectDefaults }}',
'{{ region }}'
RETURNING
cluster
;

UPDATE examples

Modifies the settings to use for a cluster.

UPDATE aws.ecs.clusters
SET
cluster = '{{ cluster }}',
settings = '{{ settings }}'
WHERE
region = '{{ region }}' --required
AND cluster = '{{ cluster }}' --required
AND settings = '{{ settings }}' --required
RETURNING
cluster;

DELETE examples

Deletes the specified cluster. The cluster transitions to the INACTIVE state. Clusters with an INACTIVE status might remain discoverable in your account for a period of time. However, this behavior is subject to change in the future. We don't recommend that you rely on INACTIVE clusters persisting. You must deregister all container instances from this cluster before you may delete it. You can list the container instances in a cluster with ListContainerInstances and deregister them with DeregisterContainerInstance.

DELETE FROM aws.ecs.clusters
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

Returns a list of existing clusters.

EXEC aws.ecs.clusters.list_clusters
@region='{{ region }}' --required
@@json=
'{
"nextToken": "{{ nextToken }}",
"maxResults": {{ maxResults }}
}'
;