- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
CreateDeploymentCommand
Deploys an application revision through the specified deployment group.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { CodeDeployClient, CreateDeploymentCommand } from "@aws-sdk/client-codedeploy"; // ES Modules import
// const { CodeDeployClient, CreateDeploymentCommand } = require("@aws-sdk/client-codedeploy"); // CommonJS import
const client = new CodeDeployClient(config);
const input = { // CreateDeploymentInput
applicationName: "STRING_VALUE", // required
deploymentGroupName: "STRING_VALUE",
revision: { // RevisionLocation
revisionType: "S3" || "GitHub" || "String" || "AppSpecContent",
s3Location: { // S3Location
bucket: "STRING_VALUE",
key: "STRING_VALUE",
bundleType: "tar" || "tgz" || "zip" || "YAML" || "JSON",
version: "STRING_VALUE",
eTag: "STRING_VALUE",
},
gitHubLocation: { // GitHubLocation
repository: "STRING_VALUE",
commitId: "STRING_VALUE",
},
string: { // RawString
content: "STRING_VALUE",
sha256: "STRING_VALUE",
},
appSpecContent: { // AppSpecContent
content: "STRING_VALUE",
sha256: "STRING_VALUE",
},
},
deploymentConfigName: "STRING_VALUE",
description: "STRING_VALUE",
ignoreApplicationStopFailures: true || false,
targetInstances: { // TargetInstances
tagFilters: [ // EC2TagFilterList
{ // EC2TagFilter
Key: "STRING_VALUE",
Value: "STRING_VALUE",
Type: "KEY_ONLY" || "VALUE_ONLY" || "KEY_AND_VALUE",
},
],
autoScalingGroups: [ // AutoScalingGroupNameList
"STRING_VALUE",
],
ec2TagSet: { // EC2TagSet
ec2TagSetList: [ // EC2TagSetList
[
{
Key: "STRING_VALUE",
Value: "STRING_VALUE",
Type: "KEY_ONLY" || "VALUE_ONLY" || "KEY_AND_VALUE",
},
],
],
},
},
autoRollbackConfiguration: { // AutoRollbackConfiguration
enabled: true || false,
events: [ // AutoRollbackEventsList
"DEPLOYMENT_FAILURE" || "DEPLOYMENT_STOP_ON_ALARM" || "DEPLOYMENT_STOP_ON_REQUEST",
],
},
updateOutdatedInstancesOnly: true || false,
fileExistsBehavior: "DISALLOW" || "OVERWRITE" || "RETAIN",
overrideAlarmConfiguration: { // AlarmConfiguration
enabled: true || false,
ignorePollAlarmFailure: true || false,
alarms: [ // AlarmList
{ // Alarm
name: "STRING_VALUE",
},
],
},
};
const command = new CreateDeploymentCommand(input);
const response = await client.send(command);
// { // CreateDeploymentOutput
// deploymentId: "STRING_VALUE",
// };
CreateDeploymentCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
applicationName Required | string | undefined | The name of an CodeDeploy application associated with the user or Amazon Web Services account. |
autoRollbackConfiguration | AutoRollbackConfiguration | undefined | Configuration information for an automatic rollback that is added when a deployment is created. |
deploymentConfigName | string | undefined | The name of a deployment configuration associated with the user or Amazon Web Services account. If not specified, the value configured in the deployment group is used as the default. If the deployment group does not have a deployment configuration associated with it, |
deploymentGroupName | string | undefined | The name of the deployment group. |
description | string | undefined | A comment about the deployment. |
fileExistsBehavior | FileExistsBehavior | undefined | Information about how CodeDeploy handles files that already exist in a deployment target location but weren't part of the previous successful deployment. The
|
ignoreApplicationStopFailures | boolean | undefined | If true, then if an If false or not specified, then if a lifecycle event fails during a deployment to an instance, that deployment fails. If deployment to that instance is part of an overall deployment and the number of healthy hosts is not less than the minimum number of healthy hosts, then a deployment to the next instance is attempted. During a deployment, the CodeDeploy agent runs the scripts specified for If the cause of the failure is a script from the last successful deployment that will never run successfully, create a new deployment and use |
overrideAlarmConfiguration | AlarmConfiguration | undefined | Allows you to specify information about alarms associated with a deployment. The alarm configuration that you specify here will override the alarm configuration at the deployment group level. Consider overriding the alarm configuration if you have set up alarms at the deployment group level that are causing deployment failures. In this case, you would call If you specify an |
revision | RevisionLocation | undefined | The type and location of the revision to deploy. |
targetInstances | TargetInstances | undefined | Information about the instances that belong to the replacement environment in a blue/green deployment. |
updateOutdatedInstancesOnly | boolean | undefined | Indicates whether to deploy to all instances or only to instances that are not running the latest application revision. |
CreateDeploymentCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
deploymentId | string | undefined | The unique ID of a deployment. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
AlarmsLimitExceededException | client | The maximum number of alarms for a deployment group (10) was exceeded. |
ApplicationDoesNotExistException | client | The application does not exist with the user or Amazon Web Services account. |
ApplicationNameRequiredException | client | The minimum number of required application names was not specified. |
DeploymentConfigDoesNotExistException | client | The deployment configuration does not exist with the user or Amazon Web Services account. |
DeploymentGroupDoesNotExistException | client | The named deployment group with the user or Amazon Web Services account does not exist. |
DeploymentGroupNameRequiredException | client | The deployment group name was not specified. |
DeploymentLimitExceededException | client | The number of allowed deployments was exceeded. |
DescriptionTooLongException | client | The description is too long. |
InvalidAlarmConfigException | client | The format of the alarm configuration is invalid. Possible causes include:
|
InvalidApplicationNameException | client | The application name was specified in an invalid format. |
InvalidAutoRollbackConfigException | client | 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. |
InvalidAutoScalingGroupException | client | The Auto Scaling group was specified in an invalid format or does not exist. |
InvalidDeploymentConfigNameException | client | The deployment configuration name was specified in an invalid format. |
InvalidDeploymentGroupNameException | client | The deployment group name was specified in an invalid format. |
InvalidFileExistsBehaviorException | client | An invalid fileExistsBehavior option was specified to determine how 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." |
InvalidGitHubAccountTokenException | client | The GitHub token is not valid. |
InvalidIgnoreApplicationStopFailuresValueException | client | The IgnoreApplicationStopFailures value is invalid. For Lambda deployments, |
InvalidLoadBalancerInfoException | client | An invalid load balancer name, or no load balancer name, was specified. |
InvalidRevisionException | client | The revision was specified in an invalid format. |
InvalidRoleException | client | The service role ARN was specified in an invalid format. Or, if an Auto Scaling group was specified, the specified service role does not grant the appropriate permissions to Amazon EC2 Auto Scaling. |
InvalidTargetInstancesException | client | The target instance configuration is invalid. Possible causes include:
|
InvalidTrafficRoutingConfigurationException | client | The configuration that specifies how traffic is routed during a deployment is invalid. |
InvalidUpdateOutdatedInstancesOnlyValueException | client | The UpdateOutdatedInstancesOnly value is invalid. For Lambda deployments, |
RevisionDoesNotExistException | client | The named revision does not exist with the user or Amazon Web Services account. |
RevisionRequiredException | client | The revision ID was not specified. |
ThrottlingException | client | An API function was called too frequently. |
CodeDeployServiceException | Base exception class for all service exceptions from CodeDeploy service. |