create_deployment
(**kwargs)¶Deploys an application revision through the specified deployment group.
See also: AWS API Documentation
Request Syntax
response = client.create_deployment(
applicationName='string',
deploymentGroupName='string',
revision={
'revisionType': 'S3'|'GitHub'|'String'|'AppSpecContent',
's3Location': {
'bucket': 'string',
'key': 'string',
'bundleType': 'tar'|'tgz'|'zip'|'YAML'|'JSON',
'version': 'string',
'eTag': 'string'
},
'gitHubLocation': {
'repository': 'string',
'commitId': 'string'
},
'string': {
'content': 'string',
'sha256': 'string'
},
'appSpecContent': {
'content': 'string',
'sha256': 'string'
}
},
deploymentConfigName='string',
description='string',
ignoreApplicationStopFailures=True|False,
targetInstances={
'tagFilters': [
{
'Key': 'string',
'Value': 'string',
'Type': 'KEY_ONLY'|'VALUE_ONLY'|'KEY_AND_VALUE'
},
],
'autoScalingGroups': [
'string',
],
'ec2TagSet': {
'ec2TagSetList': [
[
{
'Key': 'string',
'Value': 'string',
'Type': 'KEY_ONLY'|'VALUE_ONLY'|'KEY_AND_VALUE'
},
],
]
}
},
autoRollbackConfiguration={
'enabled': True|False,
'events': [
'DEPLOYMENT_FAILURE'|'DEPLOYMENT_STOP_ON_ALARM'|'DEPLOYMENT_STOP_ON_REQUEST',
]
},
updateOutdatedInstancesOnly=True|False,
fileExistsBehavior='DISALLOW'|'OVERWRITE'|'RETAIN',
overrideAlarmConfiguration={
'enabled': True|False,
'ignorePollAlarmFailure': True|False,
'alarms': [
{
'name': 'string'
},
]
}
)
[REQUIRED]
The name of an CodeDeploy application associated with the IAM user or Amazon Web Services account.
The type and location of the revision to deploy.
The type of application revision:
AppSpecContent
object that contains the contents of an AppSpec file for an Lambda or Amazon ECS deployment. The content is formatted as JSON or YAML stored as a RawString.Information about the location of a revision stored in Amazon S3.
The name of the Amazon S3 bucket where the application revision is stored.
The name of the Amazon S3 object that represents the bundled artifacts for the application revision.
The file type of the application revision. Must be one of the following:
tar
: A tar archive file.tgz
: A compressed tar archive file.zip
: A zip archive file.A specific version of the Amazon S3 object that represents the bundled artifacts for the application revision.
If the version is not specified, the system uses the most recent version by default.
The ETag of the Amazon S3 object that represents the bundled artifacts for the application revision.
If the ETag is not specified as an input parameter, ETag validation of the object is skipped.
Information about the location of application artifacts stored in GitHub.
The GitHub account and repository pair that stores a reference to the commit that represents the bundled artifacts for the application revision.
Specified as account/repository.
The SHA1 commit ID of the GitHub commit that represents the bundled artifacts for the application revision.
Information about the location of an Lambda deployment revision stored as a RawString.
The YAML-formatted or JSON-formatted revision string. It includes information about which Lambda function to update and optional Lambda functions that validate deployment lifecycle events.
The SHA256 hash value of the revision content.
The content of an AppSpec file for an Lambda or Amazon ECS deployment. The content is formatted as JSON or YAML and stored as a RawString.
The YAML-formatted or JSON-formatted revision string.
For an Lambda deployment, the content includes a Lambda function name, the alias for its original version, and the alias for its replacement version. The deployment shifts traffic from the original version of the Lambda function to the replacement version.
For an Amazon ECS deployment, the content includes the task name, information about the load balancer that serves traffic to the container, and more.
For both types of deployments, the content can specify Lambda functions that run at specified hooks, such as BeforeInstall
, during a deployment.
The SHA256 hash value of the revision content.
The name of a deployment configuration associated with the IAM 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, CodeDeployDefault
. OneAtATime
is used by default.
If true, then if an ApplicationStop
, BeforeBlockTraffic
, or AfterBlockTraffic
deployment lifecycle event to an instance fails, then the deployment continues to the next deployment lifecycle event. For example, if ApplicationStop
fails, the deployment continues with DownloadBundle
. If BeforeBlockTraffic
fails, the deployment continues with BlockTraffic
. If AfterBlockTraffic
fails, the deployment continues with ApplicationStop
.
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 ApplicationStop
, BeforeBlockTraffic
, and AfterBlockTraffic
in the AppSpec file from the previous successful deployment. (All other scripts are run from the AppSpec file in the current deployment.) If one of these scripts contains an error and does not run successfully, the deployment can fail.
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 ignoreApplicationStopFailures
to specify that the ApplicationStop
, BeforeBlockTraffic
, and AfterBlockTraffic
failures should be ignored.
Information about the instances that belong to the replacement environment in a blue/green deployment.
The tag filter key, type, and value used to identify Amazon EC2 instances in a replacement environment for a blue/green deployment. Cannot be used in the same call as ec2TagSet
.
Information about an EC2 tag filter.
The tag filter key.
The tag filter value.
The tag filter type:
KEY_ONLY
: Key only.VALUE_ONLY
: Value only.KEY_AND_VALUE
: Key and value.The names of one or more Auto Scaling groups to identify a replacement environment for a blue/green deployment.
Information about the groups of Amazon EC2 instance tags that an instance must be identified by in order for it to be included in the replacement environment for a blue/green deployment. Cannot be used in the same call as tagFilters
.
A list that contains other lists of Amazon EC2 instance tag groups. For an instance to be included in the deployment group, it must be identified by all of the tag groups in the list.
Information about an EC2 tag filter.
The tag filter key.
The tag filter value.
The tag filter type:
KEY_ONLY
: Key only.VALUE_ONLY
: Value only.KEY_AND_VALUE
: Key and value.Configuration information for an automatic rollback that is added when a deployment is created.
Indicates whether a defined automatic rollback configuration is currently enabled.
The event type or types that trigger a rollback.
Information about how 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:
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 CreateDeployment
to create a new deployment that uses a previous application revision that is known to work, and set its alarm configuration to turn off alarm polling. Turning off alarm polling ensures that the new deployment proceeds without being blocked by the alarm that was generated by the previous, failed, deployment.
Note
If you specify an overrideAlarmConfiguration
, you need the UpdateDeploymentGroup
IAM permission when calling CreateDeployment
.
Indicates whether the alarm configuration is enabled.
Indicates whether a deployment should continue if information about the current state of alarms cannot be retrieved from Amazon CloudWatch. The default value is false.
true
: The deployment proceeds even if alarm status information can't be retrieved from Amazon CloudWatch.false
: The deployment stops if alarm status information can't be retrieved from Amazon CloudWatch.A list of alarms configured for the deployment or deployment group. A maximum of 10 alarms can be added.
Information about an alarm.
The name of the alarm. Maximum length is 255 characters. Each alarm name can be used only once in a list of alarms.
dict
Response Syntax
{
'deploymentId': 'string'
}
Response Structure
(dict) --
Represents the output of a CreateDeployment
operation.
deploymentId (string) --
The unique ID of a deployment.
Exceptions
CodeDeploy.Client.exceptions.ApplicationNameRequiredException
CodeDeploy.Client.exceptions.InvalidApplicationNameException
CodeDeploy.Client.exceptions.ApplicationDoesNotExistException
CodeDeploy.Client.exceptions.DeploymentGroupNameRequiredException
CodeDeploy.Client.exceptions.InvalidDeploymentGroupNameException
CodeDeploy.Client.exceptions.DeploymentGroupDoesNotExistException
CodeDeploy.Client.exceptions.RevisionRequiredException
CodeDeploy.Client.exceptions.RevisionDoesNotExistException
CodeDeploy.Client.exceptions.InvalidRevisionException
CodeDeploy.Client.exceptions.InvalidDeploymentConfigNameException
CodeDeploy.Client.exceptions.DeploymentConfigDoesNotExistException
CodeDeploy.Client.exceptions.DescriptionTooLongException
CodeDeploy.Client.exceptions.DeploymentLimitExceededException
CodeDeploy.Client.exceptions.InvalidTargetInstancesException
CodeDeploy.Client.exceptions.InvalidAlarmConfigException
CodeDeploy.Client.exceptions.AlarmsLimitExceededException
CodeDeploy.Client.exceptions.InvalidAutoRollbackConfigException
CodeDeploy.Client.exceptions.InvalidLoadBalancerInfoException
CodeDeploy.Client.exceptions.InvalidFileExistsBehaviorException
CodeDeploy.Client.exceptions.InvalidRoleException
CodeDeploy.Client.exceptions.InvalidAutoScalingGroupException
CodeDeploy.Client.exceptions.ThrottlingException
CodeDeploy.Client.exceptions.InvalidUpdateOutdatedInstancesOnlyValueException
CodeDeploy.Client.exceptions.InvalidIgnoreApplicationStopFailuresValueException
CodeDeploy.Client.exceptions.InvalidGitHubAccountTokenException
CodeDeploy.Client.exceptions.InvalidTrafficRoutingConfigurationException