AWS Tools for Windows PowerShell
Command Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Synopsis

Calls the AWS CodeDeploy CreateDeployment API operation.

Syntax

New-CDDeployment
-ApplicationName <String>
-OverrideAlarmConfiguration_Alarm <Alarm[]>
-TargetInstancesAutoScalingGroup <String[]>
-S3Location_Bucket <String>
-S3Location_BundleType <BundleType>
-GitHubLocation_CommitId <String>
-AppSpecContent_Content <String>
-String_Content <String>
-DeploymentConfigName <String>
-DeploymentGroupName <String>
-Description <String>
-Ec2TagSetList <EC2TagFilter[][]>
-AutoRollbackConfiguration_Enabled <Boolean>
-OverrideAlarmConfiguration_Enabled <Boolean>
-S3Location_ETag <String>
-AutoRollbackConfiguration_Event <String[]>
-FileExistsBehavior <FileExistsBehavior>
-IgnoreApplicationStopFailure <Boolean>
-OverrideAlarmConfiguration_IgnorePollAlarmFailure <Boolean>
-S3Location_Key <String>
-GitHubLocation_Repository <String>
-RevisionType <RevisionLocationType>
-AppSpecContent_Sha256 <String>
-String_Sha256 <String>
-TargetInstancesTagFilter <EC2TagFilter[]>
-UpdateOutdatedInstancesOnly <Boolean>
-S3Location_Version <String>
-Select <String>
-PassThru <SwitchParameter>
-Force <SwitchParameter>
-ClientConfig <AmazonCodeDeployConfig>

Description

Deploys an application revision through the specified deployment group.

Parameters

-ApplicationName <String>
The name of an CodeDeploy application associated with the user or Amazon Web Services account.
Required?True
Position?1
Accept pipeline input?True (ByValue, ByPropertyName)
-AppSpecContent_Content <String>
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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRevision_AppSpecContent_Content
-AppSpecContent_Sha256 <String>
The SHA256 hash value of the revision content.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRevision_AppSpecContent_Sha256
-AutoRollbackConfiguration_Enabled <Boolean>
Indicates whether a defined automatic rollback configuration is currently enabled.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-AutoRollbackConfiguration_Event <String[]>
The event type or types that trigger a rollback.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesAutoRollbackConfiguration_Events
-ClientConfig <AmazonCodeDeployConfig>
Amazon.PowerShell.Cmdlets.CD.AmazonCodeDeployClientCmdlet.ClientConfig
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-DeploymentConfigName <String>
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, CodeDeployDefault.OneAtATime is used by default.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-DeploymentGroupName <String>
The name of the deployment group.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Description <String>
A comment about the deployment.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Ec2TagSetList <EC2TagFilter[][]>
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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-FileExistsBehavior <FileExistsBehavior>
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:
  • 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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
This parameter overrides confirmation prompts to force the cmdlet to continue its operation. This parameter should always be used with caution.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-GitHubLocation_CommitId <String>
The SHA1 commit ID of the GitHub commit that represents the bundled artifacts for the application revision.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRevision_GitHubLocation_CommitId
-GitHubLocation_Repository <String>
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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRevision_GitHubLocation_Repository
-IgnoreApplicationStopFailure <Boolean>
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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesIgnoreApplicationStopFailures
-OverrideAlarmConfiguration_Alarm <Alarm[]>
A list of alarms configured for the deployment or deployment group. A maximum of 10 alarms can be added.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesOverrideAlarmConfiguration_Alarms
-OverrideAlarmConfiguration_Enabled <Boolean>
Indicates whether the alarm configuration is enabled.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-OverrideAlarmConfiguration_IgnorePollAlarmFailure <Boolean>
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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-PassThru <SwitchParameter>
Changes the cmdlet behavior to return the value passed to the ApplicationName parameter. The -PassThru parameter is deprecated, use -Select '^ApplicationName' instead. This parameter will be removed in a future version.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-RevisionType <RevisionLocationType>
The type of application revision:
  • S3: An application revision stored in Amazon S3.
  • GitHub: An application revision stored in GitHub (EC2/On-premises deployments only).
  • String: A YAML-formatted or JSON-formatted string (Lambda deployments only).
  • AppSpecContent: An 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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRevision_RevisionType
-S3Location_Bucket <String>
The name of the Amazon S3 bucket where the application revision is stored.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRevision_S3Location_Bucket
-S3Location_BundleType <BundleType>
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.
  • YAML: A YAML-formatted file.
  • JSON: A JSON-formatted file.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRevision_S3Location_BundleType
-S3Location_ETag <String>
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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRevision_S3Location_ETag
-S3Location_Key <String>
The name of the Amazon S3 object that represents the bundled artifacts for the application revision.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRevision_S3Location_Key
-S3Location_Version <String>
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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRevision_S3Location_Version
-Select <String>
Use the -Select parameter to control the cmdlet output. The default value is 'DeploymentId'. Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.CodeDeploy.Model.CreateDeploymentResponse). Specifying the name of a property of type Amazon.CodeDeploy.Model.CreateDeploymentResponse will result in that property being returned. Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-String_Content <String>
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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRevision_String_Content
-String_Sha256 <String>
The SHA256 hash value of the revision content.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRevision_String_Sha256
-TargetInstancesAutoScalingGroup <String[]>
The names of one or more Auto Scaling groups to identify a replacement environment for a blue/green deployment.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTargetInstances_AutoScalingGroup, TargetInstances_AutoScalingGroups
-TargetInstancesTagFilter <EC2TagFilter[]>
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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTargetInstances_TagFilter, TargetInstances_TagFilters
-UpdateOutdatedInstancesOnly <Boolean>
Indicates whether to deploy to all instances or only to instances that are not running the latest application revision.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)

Common Credential and Region Parameters

-AccessKey <String>
The AWS access key for the user account. This can be a temporary access key if the corresponding session token is supplied to the -SessionToken parameter.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesAK
-Credential <AWSCredentials>
An AWSCredentials object instance containing access and secret key information, and optionally a token for session-based credentials.
Required?False
Position?Named
Accept pipeline input?True (ByValue, ByPropertyName)
-EndpointUrl <String>
The endpoint to make the call against.Note: This parameter is primarily for internal AWS use and is not required/should not be specified for normal usage. The cmdlets normally determine which endpoint to call based on the region specified to the -Region parameter or set as default in the shell (via Set-DefaultAWSRegion). Only specify this parameter if you must direct the call to a specific custom endpoint.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-NetworkCredential <PSCredential>
Used with SAML-based authentication when ProfileName references a SAML role profile. Contains the network credentials to be supplied during authentication with the configured identity provider's endpoint. This parameter is not required if the user's default network identity can or should be used during authentication.
Required?False
Position?Named
Accept pipeline input?True (ByValue, ByPropertyName)
-ProfileLocation <String>
Used to specify the name and location of the ini-format credential file (shared with the AWS CLI and other AWS SDKs)If this optional parameter is omitted this cmdlet will search the encrypted credential file used by the AWS SDK for .NET and AWS Toolkit for Visual Studio first. If the profile is not found then the cmdlet will search in the ini-format credential file at the default location: (user's home directory)\.aws\credentials.If this parameter is specified then this cmdlet will only search the ini-format credential file at the location given.As the current folder can vary in a shell or during script execution it is advised that you use specify a fully qualified path instead of a relative path.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesAWSProfilesLocation, ProfilesLocation
-ProfileName <String>
The user-defined name of an AWS credentials or SAML-based role profile containing credential information. The profile is expected to be found in the secure credential file shared with the AWS SDK for .NET and AWS Toolkit for Visual Studio. You can also specify the name of a profile stored in the .ini-format credential file used with the AWS CLI and other AWS SDKs.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesStoredCredentials, AWSProfileName
-Region <Object>
The system name of an AWS region or an AWSRegion instance. This governs the endpoint that will be used when calling service operations. Note that the AWS resources referenced in a call are usually region-specific.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRegionToCall
-SecretKey <String>
The AWS secret key for the user account. This can be a temporary secret key if the corresponding session token is supplied to the -SessionToken parameter.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesSK, SecretAccessKey
-SessionToken <String>
The session token if the access and secret keys are temporary session-based credentials.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesST

Outputs

This cmdlet returns a System.String object. The service call response (type Amazon.CodeDeploy.Model.CreateDeploymentResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack.

Examples

Example 1

New-CDDeployment -ApplicationName MyNewApplication -S3Location_Bucket MyBucket -S3Location_BundleType zip -DeploymentConfigName CodeDeployDefault.OneAtATime -DeploymentGroupName MyNewDeploymentGroup -IgnoreApplicationStopFailures $True -S3Location_Key aws-codedeploy_linux-master.zip -RevisionType S3

d-ZHROG7UEX
This example creates a new deployment for the specified application and deployment group with the specified deployment configuration and application revision.

Example 2

New-CDDeployment -ApplicationName MyNewApplication -S3Location_Bucket MyBucket -S3Location_BundleType zip -DeploymentConfigName CodeDeployDefault.OneAtATime -DeploymentGroupName MyNewDeploymentGroup -IgnoreApplicationStopFailures $True -S3Location_Key aws-codedeploy_linux-master.zip -RevisionType S3 -Ec2TagSetList @(@{Key="key1";Type="KEY_ONLY"},@{Key="Key2";Type="KEY_AND_VALUE";Value="Value2"}),@(@{Key="Key3";Type="VALUE_ONLY";Value="Value3"})

d-ZHROG7UEX
This example shows how to specify groups of 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.

Supported Version

AWS Tools for PowerShell: 2.x.y.z