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

CreateDeployment

Deploys an application revision through the specified deployment group.

Request Syntax

Copy
{ "applicationName": "string", "autoRollbackConfiguration": { "enabled": boolean, "events": [ "string" ] }, "deploymentConfigName": "string", "deploymentGroupName": "string", "description": "string", "fileExistsBehavior": "string", "ignoreApplicationStopFailures": boolean, "revision": { "gitHubLocation": { "commitId": "string", "repository": "string" }, "revisionType": "string", "s3Location": { "bucket": "string", "bundleType": "string", "eTag": "string", "key": "string", "version": "string" } }, "targetInstances": { "autoScalingGroups": [ "string" ], "tagFilters": [ { "Key": "string", "Type": "string", "Value": "string" } ] }, "updateOutdatedInstancesOnly": boolean }

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.

applicationName

The name of an AWS CodeDeploy application associated with the applicable IAM user or AWS account.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 100.

Required: Yes

autoRollbackConfiguration

Configuration information for an automatic rollback that is added when a deployment is created.

Type: AutoRollbackConfiguration object

Required: No

deploymentConfigName

The name of a deployment configuration associated with the applicable IAM user or AWS account.

If not specified, the value configured in the deployment group will be used as the default. If the deployment group does not have a deployment configuration associated with it, then CodeDeployDefault.OneAtATime will be used by default.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 100.

Required: No

deploymentGroupName

The name of the deployment group.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 100.

Required: No

description

A comment about the deployment.

Type: String

Required: No

fileExistsBehavior

Information about how AWS CodeDeploy handles files that already exist in a deployment target location but weren't part of the previous successful deployment.

The fileExistsBehavior parameter takes any of the following values:

  • DISALLOW: The deployment fails. This is also the default behavior if no option is specified.

  • OVERWRITE: The version of the file from the application revision currently being deployed replaces the version already on the instance.

  • RETAIN: The version of the file already on the instance is kept and used as part of the new deployment.

Type: String

Valid Values: DISALLOW | OVERWRITE | RETAIN

Required: No

ignoreApplicationStopFailures

If set to true, then if the deployment causes the ApplicationStop deployment lifecycle event to an instance to fail, the deployment to that instance will not be considered to have failed at that point and will continue on to the BeforeInstall deployment lifecycle event.

If set to false or not specified, then if the deployment causes the ApplicationStop deployment lifecycle event to fail to an instance, the deployment to that instance will stop, and the deployment to that instance will be considered to have failed.

Type: Boolean

Required: No

revision

The type and location of the revision to deploy.

Type: RevisionLocation object

Required: No

targetInstances

Information about the instances that will belong to the replacement environment in a blue/green deployment.

Type: TargetInstances object

Required: No

updateOutdatedInstancesOnly

Indicates whether to deploy to all instances or only to instances that are not running the latest application revision.

Type: Boolean

Required: No

Response Syntax

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

deploymentId

A unique deployment ID.

Type: String

Errors

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

ApplicationDoesNotExistException

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

HTTP Status Code: 400

ApplicationNameRequiredException

The minimum number of required application names was not specified.

HTTP Status Code: 400

DeploymentConfigDoesNotExistException

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

HTTP Status Code: 400

DeploymentGroupDoesNotExistException

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

HTTP Status Code: 400

DeploymentGroupNameRequiredException

The deployment group name was not specified.

HTTP Status Code: 400

DeploymentLimitExceededException

The number of allowed deployments was exceeded.

HTTP Status Code: 400

DescriptionTooLongException

The description is too long.

HTTP Status Code: 400

InvalidApplicationNameException

The application name was specified in an invalid format.

HTTP Status Code: 400

InvalidAutoRollbackConfigException

The automatic rollback configuration was specified in an invalid format. For example, automatic rollback is enabled but an invalid triggering event type or no event types were listed.

HTTP Status Code: 400

InvalidDeploymentConfigNameException

The deployment configuration name was specified in an invalid format.

HTTP Status Code: 400

InvalidDeploymentGroupNameException

The deployment group name was specified in an invalid format.

HTTP Status Code: 400

InvalidFileExistsBehaviorException

An invalid fileExistsBehavior option was specified to determine how AWS CodeDeploy handles files or directories that already exist in a deployment target location but weren't part of the previous successful deployment. Valid values include "DISALLOW", "OVERWRITE", and "RETAIN".

HTTP Status Code: 400

InvalidLoadBalancerInfoException

An invalid load balancer name, or no load balancer name, was specified.

HTTP Status Code: 400

InvalidRevisionException

The revision was specified in an invalid format.

HTTP Status Code: 400

InvalidTargetInstancesException

The target instance configuration is invalid. Possible causes include:

  • Configuration data for target instances was entered for an in-place deployment.

  • The limit of 10 tags for a tag type was exceeded.

  • The combined length of the tag names exceeded the limit.

  • A specified tag is not currently applied to any instances.

HTTP Status Code: 400

RevisionDoesNotExistException

The named revision does not exist with the applicable IAM user or AWS account.

HTTP Status Code: 400

RevisionRequiredException

The revision ID was not specified.

HTTP Status Code: 400

Example

Sample Request

Copy
POST / HTTP/1.1 Host: codedeploy.us-east-1.amazonaws.com Accept-Encoding: identity Content-Length: 305 X-Amz-Target: CodeDeploy_20141006.CreateDeployment X-Amz-Date: 20160707T235543Z User-Agent: aws-cli/1.10.6 Python/2.7.9 Windows/7 botocore/1.3.28 Content-Type: application/x-amz-json-1.1 Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20160707/us-east-1/codedeploy/aws4_request, SignedHeaders=content-type;host;user-agent;x-amz-date;x-amz-target, Signature=39c3b3042cd2aEXAMPLE { "applicationName": "TestApp-ap-southeast-2", "autoRollbackConfiguration": { "enabled": true, "events": [ "DEPLOYMENT_FAILURE" ] }, "deploymentGroupName": "dep-group-ghi-789", "description": "Deployment for Project 1234", "deploymentConfigName": "CodeDeployDefault.OneAtATime", "ignoreApplicationStopFailures": true, "revision": { "revisionType": "S3", "s3Location": { "bundleType": "zip", "bucket": "project-1234", "key": "East-App.zip" }, "updateOutdatedInstancesOnly": true } }

Sample Response

Copy
HTTP/1.1 200 OK x-amzn-RequestId: b8d39558-88cf-11f5-96e5-8bf4ee0ce84e Content-Type: application/x-amz-json-1.1 Content-Length: 30 { "deploymentId": "d-IIMHK0NHC" }

See Also

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