Search code examples
continuous-integrationaws-code-deployaws-codepipelinecontinuous-deliveryaws-cdk

Setting up CI/CD for an AWS CDK app using AWS CodeBuild/Deploy/Pipeline


I'm trying to setup a CI/CD pipeline for a dotnet app which uses AWS Lambda and AWS CDK for infrastructure. The source is on github and we have a Jenkins pipeline which runs the tests and publishes the artifacts. I want to use the artifact and deploy (or better use Code Deploy)

Can I use CodePipeline to run cdk deploy? How can I use CodeDeploy to do a dotnet test and dotnet publish? and then pass on the artifact to CodePipeline


Solution

  • CodePipeline is a workflow service, it by itself cannot execute any commands. What you need is a Build/Test service like CodeBuild and/or Jenkins as part of the CodePipeline. This is where you will run the commands like 'cdk deploy', 'dotnet test' and 'dotnet publish'.

    Once the Deployment artifacts are ready in the Build environment (using the aforementioned commands), the next CodePipeline Stage can use them to deploy - this is where a Service like CodeDeploy will be used.

    CodePipeline is just orchestrating the workflow between the building block services like CodeCommit (Source), CodeBuild (Build/Test) and CodeDeploy (Deploy). There are many more integrations available.

    Hope this helps.