StopServiceDeployment - Amazon Elastic Container Service

StopServiceDeployment

Stops an ongoing service deployment.

The following stop types are avaiable:

  • ROLLBACK - This option rolls back the service deployment to the previous service revision.

    You can use this option even if you didn't configure the service deployment for the rollback option.

For more information, see Stopping Amazon ECS service deployments in the Amazon Elastic Container Service Developer Guide.

Request Syntax

{ "serviceDeploymentArn": "string", "stopType": "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.

serviceDeploymentArn

The ARN of the service deployment that you want to stop.

Type: String

Required: Yes

stopType

How you want Amazon ECS to stop the service.

The valid values are ROLLBACK.

Type: String

Valid Values: ABORT | ROLLBACK

Required: No

Response Syntax

{ "serviceDeploymentArn": "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.

serviceDeploymentArn

The ARN of the stopped service deployment.

Type: String

Errors

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

AccessDeniedException

You don't have authorization to perform the requested action.

HTTP Status Code: 400

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.

HTTP Status Code: 400

ConflictException

The request could not be processed because of conflict in the current state of the resource.

HTTP Status Code: 400

InvalidParameterException

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

For more information about service event errors, see Amazon ECS service event messages.

HTTP Status Code: 400

ServerException

These errors are usually caused by a server issue.

HTTP Status Code: 500

ServiceDeploymentNotFoundException

The service deploy ARN that you specified in the StopServiceDeployment doesn't exist. You can use ListServiceDeployments to retrieve the service deployment ARNs.

HTTP Status Code: 400

UnsupportedFeatureException

The specified task isn't supported in this Region.

HTTP Status Code: 400

Examples

Example

This example request stops the service deployment with the ARN of arn:aws:ecs:us-east-1:123456789012:service-deployment/MyCluster/MyService/r9i43YFjvgF_xlg7m2eJ1using the ROLLBACK stop type.

Sample Request

POST / HTTP/1.1 Host: ecs.us-west-2.amazonaws.com Accept-Encoding: identity Content-Length: 55 X-Amz-Target: AmazonEC2ContainerServiceV20141113.StopServiceDeployment X-Amz-Date: 20250407T133521Z User-Agent: aws-cli/2.26 Python/3.12.6 Darwin/14.3.0 Content-Type: application/x-amz-json-1.1 Authorization: AUTHPARAMS { "serviceDeploymentArn": "arn:aws:ecs:us-east-1:123456789012:service-deployment/MyCluster/MyService/r9i43YFjvgF_xlg7m2eJ1", "stopType": "ROLLBACK" }

Sample Response

HTTP/1.1 200 OK Server: Server Date: Mon Apr 7, 2025 18:50:14 GMT Content-Type: application/x-amz-json-1.1 Content-Length: 220 Connection: keep-alive RequestId: 360c5551-123e-4e74-9914-7582d3a28807 { "serviceDeploymentArn": "arn:aws:ecs:us-east-1:123456789012:service-deployment/MyCluster/MyService/r9i43YFjvgF_xlg7m2eJ1", } }

See Also

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