AWS CodeDeploy
API Reference (API Version 2014-10-06)

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.


Returns an array of one or more targets associated with a deployment. This method works with all compute types and should be used instead of the deprecated BatchGetDeploymentInstances. The maximum number of targets that can be returned is 25.

The type of targets returned depends on the deployment's compute platform:

  • EC2/On-premises: Information about EC2 instance targets.

  • AWS Lambda: Information about Lambda functions targets.

  • Amazon ECS: Information about Amazon ECS service targets.

Request Syntax

{ "deploymentId": "string", "targetIds": [ "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.


The unique ID of a deployment.

Type: String

Required: No


The unique IDs of the deployment targets. The compute platform of the deployment determines the type of the targets and their formats. The maximum number of deployment target IDs you can specify is 25.

  • For deployments that use the EC2/On-premises compute platform, the target IDs are EC2 or on-premises instances IDs, and their target type is instanceTarget.

  • For deployments that use the AWS Lambda compute platform, the target IDs are the names of Lambda functions, and their target type is instanceTarget.

  • For deployments that use the Amazon ECS compute platform, the target IDs are pairs of Amazon ECS clusters and services specified using the format <clustername>:<servicename>. Their target type is ecsTarget.

Type: Array of strings

Required: No

Response Syntax

{ "deploymentTargets": [ { "deploymentTargetType": "string", "ecsTarget": { "deploymentId": "string", "lastUpdatedAt": number, "lifecycleEvents": [ { "diagnostics": { "errorCode": "string", "logTail": "string", "message": "string", "scriptName": "string" }, "endTime": number, "lifecycleEventName": "string", "startTime": number, "status": "string" } ], "status": "string", "targetArn": "string", "targetId": "string", "taskSetsInfo": [ { "desiredCount": number, "identifer": "string", "pendingCount": number, "runningCount": number, "status": "string", "targetGroup": { "name": "string" }, "taskSetLabel": "string", "trafficWeight": number } ] }, "instanceTarget": { "deploymentId": "string", "instanceLabel": "string", "lastUpdatedAt": number, "lifecycleEvents": [ { "diagnostics": { "errorCode": "string", "logTail": "string", "message": "string", "scriptName": "string" }, "endTime": number, "lifecycleEventName": "string", "startTime": number, "status": "string" } ], "status": "string", "targetArn": "string", "targetId": "string" }, "lambdaTarget": { "deploymentId": "string", "lambdaFunctionInfo": { "currentVersion": "string", "functionAlias": "string", "functionName": "string", "targetVersion": "string", "targetVersionWeight": number }, "lastUpdatedAt": number, "lifecycleEvents": [ { "diagnostics": { "errorCode": "string", "logTail": "string", "message": "string", "scriptName": "string" }, "endTime": number, "lifecycleEventName": "string", "startTime": number, "status": "string" } ], "status": "string", "targetArn": "string", "targetId": "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.


A list of target objects for a deployment. Each target object contains details about the target, such as its status and lifecycle events. The type of the target objects depends on the deployment' compute platform.

  • EC2/On-premises: Each target object is an EC2 or on-premises instance.

  • AWS Lambda: The target object is a specific version of an AWS Lambda function.

  • Amazon ECS: The target object is an Amazon ECS service.

Type: Array of DeploymentTarget objects


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


The deployment with the IAM user or AWS account does not exist.

HTTP Status Code: 400


At least one deployment ID must be specified.

HTTP Status Code: 400


The specified deployment has not started.

HTTP Status Code: 400


The provided target ID does not belong to the attempted deployment.

HTTP Status Code: 400


A deployment target ID was not provided.

HTTP Status Code: 400


The maximum number of targets that can be associated with an Amazon ECS or AWS Lambda deployment was exceeded. The target list of both types of deployments must have exactly one item. This exception does not apply to EC2/On-premises deployments.

HTTP Status Code: 400


At least one of the deployment IDs was specified in an invalid format.

HTTP Status Code: 400


The target ID provided was not valid.

HTTP Status Code: 400

See Also

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