DeleteCluster
Deletes the specified cluster. The cluster will transition to the
INACTIVE
state. Clusters with an INACTIVE
status may
remain discoverable in your account for a period of time. However, this behavior
is
subject to change in the future, so you should not 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",
"defaultCapacityProviderStrategy": [
{
"base": number,
"capacityProvider": "string",
"weight": number
}
],
"pendingTasksCount": number,
"registeredContainerInstancesCount": number,
"runningTasksCount": number,
"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.
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 permissions 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. 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. 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 cannot delete a cluster that has active tasks.
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
- UpdateInProgressException
-
There is already a current Amazon ECS container agent update in progress on the specified container instance. If the container agent becomes disconnected while it is in a transitional stage, such as
PENDING
orSTAGING
, 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 (AWS CLI)
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: