class CdkPipeline (construct)
| Language | Type name |
|---|---|
.NET | Amazon.CDK.Pipelines.CdkPipeline |
Java | software.amazon.awscdk.pipelines.CdkPipeline |
Python | aws_cdk.pipelines.CdkPipeline |
TypeScript (source) | @aws-cdk/pipelines » CdkPipeline |
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Implements
IConstruct, IConstruct, IDependable
A Pipeline to deploy CDK apps.
Defines an AWS CodePipeline-based Pipeline to deploy CDK applications.
Automatically manages the following:
- Stack dependency order.
- Asset publishing.
- Keeping the pipeline up-to-date as the CDK apps change.
- Using stack outputs later on in the pipeline.
Example
const sourceArtifact = new codepipeline.Artifact();
const cloudAssemblyArtifact = new codepipeline.Artifact();
const pipeline = new pipelines.CdkPipeline(this, 'MyPipeline', {
cloudAssemblyArtifact,
synthAction: pipelines.SimpleSynthAction.standardNpmSynth({
sourceArtifact,
cloudAssemblyArtifact,
environment: {
privileged: true,
},
}),
});
Initializer
new CdkPipeline(scope: Construct, id: string, props: CdkPipelineProps)
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Parameters
- scope
Construct - id
string - props
CdkPipeline Props
Construct Props
| Name | Type | Description |
|---|---|---|
| cloud | Artifact | The artifact you have defined to be the artifact to hold the cloudAssemblyArtifact for the synth action. |
| asset | Build | Custom BuildSpec that is merged with generated one (for asset publishing actions). |
| asset | string[] | Additional commands to run before installing cdk-assets during the asset publishing step Use this to setup proxies or npm mirrors. |
| cdk | string | CDK CLI version to use in pipeline. |
| code | Pipeline | Existing CodePipeline to add deployment stages to. |
| cross | boolean | Create KMS keys for cross-account deployments. |
| docker | Docker[] | A list of credentials used to authenticate to Docker registries. |
| enable | boolean | Enables KMS key rotation for cross-account keys. |
| pipeline | string | Name of the pipeline. |
| self | boolean | Whether the pipeline will update itself. |
| self | Build | Custom BuildSpec that is merged with generated one (for self-mutation stage). |
| single | boolean | Whether this pipeline creates one asset upload action per asset type or one asset upload per asset. |
| source | IAction | The CodePipeline action used to retrieve the CDK app's source. |
| subnet | Subnet | Which subnets to use. |
| support | boolean | Whether the pipeline needs to build Docker images in the UpdatePipeline stage. |
| synth | IAction | The CodePipeline action build and synthesis step of the CDK app. |
| vpc? | IVpc | The VPC where to execute the CdkPipeline actions. |
cloudAssemblyArtifact
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
Artifact
The artifact you have defined to be the artifact to hold the cloudAssemblyArtifact for the synth action.
assetBuildSpec?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
Build
(optional, default: none)
Custom BuildSpec that is merged with generated one (for asset publishing actions).
assetPreInstallCommands?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
string[]
(optional, default: -)
Additional commands to run before installing cdk-assets during the asset publishing step Use this to setup proxies or npm mirrors.
cdkCliVersion?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
string
(optional, default: Latest version)
CDK CLI version to use in pipeline.
Some Actions in the pipeline will download and run a version of the CDK CLI. Specify the version here.
codePipeline?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
Pipeline
(optional, default: A new CodePipeline is automatically generated)
Existing CodePipeline to add deployment stages to.
Use this if you want more control over the CodePipeline that gets created. You can choose to not pass this value, in which case a new CodePipeline is created with default settings.
If you pass an existing CodePipeline, it should have been created
with restartExecutionOnUpdate: true.
[disable-awslint:ref-via-interface]
crossAccountKeys?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
boolean
(optional, default: true)
Create KMS keys for cross-account deployments.
This controls whether the pipeline is enabled for cross-account deployments.
Can only be set if codePipeline is not set.
By default cross-account deployments are enabled, but this feature requires that KMS Customer Master Keys are created which have a cost of $1/month.
If you do not need cross-account deployments, you can set this to false to
not create those keys and save on that cost (the artifact bucket will be
encrypted with an AWS-managed key). However, cross-account deployments will
no longer be possible.
dockerCredentials?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
Docker[]
(optional, default: [])
A list of credentials used to authenticate to Docker registries.
Specify any credentials necessary within the pipeline to build, synth, update, or publish assets.
enableKeyRotation?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
boolean
(optional, default: false (key rotation is disabled))
Enables KMS key rotation for cross-account keys.
Cannot be set if crossAccountKeys was set to false.
Key rotation costs $1/month when enabled.
pipelineName?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
string
(optional, default: A name is automatically generated)
Name of the pipeline.
Can only be set if codePipeline is not set.
selfMutating?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
boolean
(optional, default: true)
Whether the pipeline will update itself.
This needs to be set to true to allow the pipeline to reconfigure
itself when assets or stages are being added to it, and true is the
recommended setting.
You can temporarily set this to false while you are iterating
on the pipeline itself and prefer to deploy changes using cdk deploy.
selfMutationBuildSpec?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
Build
(optional, default: none)
Custom BuildSpec that is merged with generated one (for self-mutation stage).
singlePublisherPerType?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
boolean
(optional, default: false)
Whether this pipeline creates one asset upload action per asset type or one asset upload per asset.
sourceAction?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
IAction
(optional, default: Required unless codePipeline is given)
The CodePipeline action used to retrieve the CDK app's source.
subnetSelection?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
Subnet
(optional, default: All private subnets.)
Which subnets to use.
Only used if 'vpc' is supplied.
supportDockerAssets?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
boolean
(optional, default: false)
Whether the pipeline needs to build Docker images in the UpdatePipeline stage.
If the UpdatePipeline stage tries to build a Docker image and this flag is not
set to true, the build step will run in non-privileged mode and consequently
will fail with a message like:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
This flag has an effect only if selfMutating is also true.
synthAction?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
IAction
(optional, default: Required unless codePipeline or sourceAction is given)
The CodePipeline action build and synthesis step of the CDK app.
vpc?
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
IVpc
(optional, default: No VPC)
The VPC where to execute the CdkPipeline actions.
Properties
| Name | Type | Description |
|---|---|---|
| code | Pipeline | The underlying CodePipeline object. |
| node | Construct | The construct tree node associated with this construct. |
codePipeline
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
Pipeline
The underlying CodePipeline object.
You can use this to add more Stages to the pipeline, or Actions to Stages.
node
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Type:
Construct
The construct tree node associated with this construct.
Methods
| Name | Description |
|---|---|
| add | Add pipeline stage that will deploy the given application stage. |
| add | Add a new, empty stage to the pipeline. |
| stack | Get the StackOutput object that holds this CfnOutput's value in this pipeline. |
| stage(stageName) | Access one of the pipeline's stages by stage name. |
| to | Returns a string representation of this construct. |
| protected validate() | Validate that we don't have any stacks violating dependency order in the pipeline. |
addApplicationStage(appStage, options?)
public addApplicationStage(appStage: Stage, options?: AddStageOptions): CdkStage
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Parameters
- appStage
Stage - options
AddStage Options
Returns
Add pipeline stage that will deploy the given application stage.
The application construct should subclass Stage and can contain any
number of Stacks inside it that may have dependency relationships
on one another.
All stacks in the application will be deployed in the appropriate order, and all assets found in the application will be added to the asset publishing stage.
addStage(stageName, options?)
public addStage(stageName: string, options?: BaseStageOptions): CdkStage
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Parameters
- stageName
string - options
BaseStage Options
Returns
Add a new, empty stage to the pipeline.
Prefer to use addApplicationStage if you are intended to deploy a CDK
application, but you can use this method if you want to add other kinds of
Actions to a pipeline.
stackOutput(cfnOutput)
public stackOutput(cfnOutput: CfnOutput): StackOutput
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Parameters
- cfnOutput
CfnOutput
Returns
Get the StackOutput object that holds this CfnOutput's value in this pipeline.
StackOutput can be used in validation actions later in the pipeline.
stage(stageName)
public stage(stageName: string): IStage
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Parameters
- stageName
string
Returns
Access one of the pipeline's stages by stage name.
You can use this to add more Actions to a stage.
toString()
public toString(): string
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Returns
string
Returns a string representation of this construct.
protected validate()
protected validate(): string[]
⚠️ Deprecated: This class is part of the old API. Use the API based on the CodePipeline class instead
Returns
string[]
Validate that we don't have any stacks violating dependency order in the pipeline.
Our own convenience methods will never generate a pipeline that does that (although this is a nice verification), but a user can also add the stacks by hand.

.NET
Java
Python
TypeScript (