Menu
Amazon EC2 Container Service
API Reference (API Version 2014-11-13)

DeleteCluster

Deletes the specified cluster. 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

Copy
{ "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

Copy
{ "cluster": { "activeServicesCount": number, "clusterArn": "string", "clusterName": "string", "pendingTasksCount": number, "registeredContainerInstancesCount": number, "runningTasksCount": number, "status": "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, such as using an action or resource on behalf of a user that doesn't have permission to use the action or resource, or specifying an identifier that is not valid.

HTTP Status Code: 400

ClusterContainsContainerInstancesException

You cannot delete a cluster that has registered container instances. You must first deregister the container instances before you can delete the cluster. For more information, see DeregisterContainerInstance.

HTTP Status Code: 400

ClusterContainsServicesException

You cannot delete a cluster that contains services. You must 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

ClusterNotFoundException

The specified cluster could not be found. You can view your available clusters with ListClusters. Amazon ECS clusters are region-specific.

HTTP Status Code: 400

InvalidParameterException

The specified parameter is invalid. 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

Example

In the following example or examples, the Authorization header contents (AUTHPARAMS) must be replaced with an AWS Signature Version 4 signature. For more information about creating these signatures, 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 manually create them. When you use the AWS Command Line Interface (AWS CLI) 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 need to learn how to sign requests yourself.

Example

This example request deletes the cluster called My-cluster.

Sample Request

Copy
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

Copy
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: