DeleteCluster - Amazon Elastic Container Service

DeleteCluster

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.

Request Syntax

{ "cluster": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

cluster

The short name or full Amazon Resource Name (ARN) of the cluster to delete.

Type: String

Required: Yes

Response Syntax

{ "cluster": { "activeServicesCount": number, "attachments": [ { "details": [ { "name": "string", "value": "string" } ], "id": "string", "status": "string", "type": "string" } ], "attachmentsStatus": "string", "capacityProviders": [ "string" ], "clusterArn": "string", "clusterName": "string", "configuration": { "executeCommandConfiguration": { "kmsKeyId": "string", "logConfiguration": { "cloudWatchEncryptionEnabled": boolean, "cloudWatchLogGroupName": "string", "s3BucketName": "string", "s3EncryptionEnabled": boolean, "s3KeyPrefix": "string" }, "logging": "string" }, "managedStorageConfiguration": { "fargateEphemeralStorageKmsKeyId": "string", "kmsKeyId": "string" } }, "defaultCapacityProviderStrategy": [ { "base": number, "capacityProvider": "string", "weight": number } ], "pendingTasksCount": number, "registeredContainerInstancesCount": number, "runningTasksCount": number, "serviceConnectDefaults": { "namespace": "string" }, "settings": [ { "name": "string", "value": "string" } ], "statistics": [ { "name": "string", "value": "string" } ], "status": "string", "tags": [ { "key": "string", "value": "string" } ] } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

cluster

The full description of the deleted cluster.

Type: Cluster object

Errors

For information about the errors that are common to all actions, see Common Errors.

ClientException

These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.

The following list includes additional causes for the error:

  • The RunTask could not be processed because you use managed scaling and there is a capacity error because the quota of tasks in the PROVISIONING per cluster has been reached. For information about the service quotas, see Amazon ECS service quotas.

HTTP Status Code: 400

ClusterContainsContainerInstancesException

You can't delete a cluster that has registered container instances. First, deregister the container instances before you can delete the cluster. For more information, see DeregisterContainerInstance.

HTTP Status Code: 400

ClusterContainsServicesException

You can't delete a cluster that contains services. First, update the service to reduce its desired task count to 0, and then delete the service. For more information, see UpdateService and DeleteService.

HTTP Status Code: 400

ClusterContainsTasksException

You can't delete a cluster that has active tasks.

HTTP Status Code: 400

ClusterNotFoundException

The specified cluster wasn't found. You can view your available clusters with ListClusters. Amazon ECS clusters are Region specific.

HTTP Status Code: 400

InvalidParameterException

The specified parameter isn't valid. Review the available parameters for the API request.

HTTP Status Code: 400

ServerException

These errors are usually caused by a server issue.

HTTP Status Code: 500

UpdateInProgressException

There's already a current Amazon ECS container agent update in progress on the container instance that's specified. If the container agent becomes disconnected while it's in a transitional stage, such as PENDING or STAGING, the update process can get stuck in that state. However, when the agent reconnects, it resumes where it stopped previously.

HTTP Status Code: 400

Examples

In the following example or examples, the Authorization header contents (AUTHPARAMS) must be replaced with an AWS Signature Version 4 signature. For more information, see Signature Version 4 Signing Process in the AWS General Reference.

You only need to learn how to sign HTTP requests if you intend to create them manually. When you use the AWS Command Line Interface or one of the AWS SDKs to make requests to AWS, these tools automatically sign the requests for you, with the access key that you specify when you configure the tools. When you use these tools, you don't have to sign requests yourself.

Example

This example request deletes the cluster called My-cluster.

Sample Request

POST / HTTP/1.1 Host: ecs.us-east-1.amazonaws.com Accept-Encoding: identity Content-Length: 25 X-Amz-Target: AmazonEC2ContainerServiceV20141113.DeleteCluster X-Amz-Date: 20150429T170952Z Content-Type: application/x-amz-json-1.1 Authorization: AUTHPARAMS { "cluster": "My-cluster" }

Sample Response

HTTP/1.1 200 OK Server: Server Date: Wed, 29 Apr 2015 17:09:54 GMT Content-Type: application/x-amz-json-1.1 Content-Length: 211 Connection: keep-alive x-amzn-RequestId: 123a4b56-7c89-01d2-3ef4-example5678f { "cluster": { "activeServicesCount": 0, "clusterArn": "arn:aws:ecs:us-east-1:012345678910:cluster/My-cluster", "clusterName": "My-cluster", "pendingTasksCount": 0, "registeredContainerInstancesCount": 0, "runningTasksCount": 0, "status": "INACTIVE" } }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: