I have an AWS CDK project and am defining a code pipeline with the CDK to automatically deploy it.
Should I use the CodePipeline defined here: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines.CodePipeline.html
or the Pipeline defined here: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Pipeline.html
Also what exactly is the difference between the two?
Edit: I linked to the wrong doc for Pipeline. I’ve updated the link
2
Answers
Largely the version of CDK it’s under.
Pipeline
is in v1.x whileCodePipeline
is new to v2.x, but both represent the same underlying resource.The v1.x version exists in the v2.x library for backwards compatibility and to facilitate teams migrating to v2.x.
In December of 2021, the CDK project released a major refactor of the toolkit, including many new features. The version you should use depends on which version you have bootstrapped to your account.
See the documentation for migrating to CDKv2 for more information.
aws-codepipeline.Pipeline
is an L2 construct for the AWS CodePipeline resource.pipelines.CodePipeline
is part of the CDK pipelines module that is a higher-level abstraction for deploying CDK apps. Under the hood, it usesaws-codepipeline.Pipeline
for its pipelines, but there are also other implementations (with GitHub Actions, for example), since thepipelines.CodePipeline
API was meant to be an abstract API (the naming is unfortunate, though). Further reading: https://docs.aws.amazon.com/cdk/v2/guide/cdk_pipeline.html