Is there a way to export existing CodePipeline/CodeBuild projects to Cloudformation?
I'm in the process of converting our existing CI/CD infrastructure into code so it would be easy to replicate them on other AWS regions.
Currently, we've done all our CodePipeline/CodeBuild projects through the AWS console in the browser and obviously, this is tedious and error-prone.
Create a stack from existing resources using the AWS Management Console. Sign in to the AWS Management Console and open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation . On the Stacks page, choose Create stack, and then choose With existing resources (import resources).
CodePipeline builds, tests, and deploys your code every time there is a code change, based on the release process models you define. AWS CodeBuild can be classified as a tool in the "Continuous Integration" category, while AWS CodePipeline is grouped under "Continuous Deployment".
If you have some codepipeline already created use the cli to extract them as cloudformation.
The command is roughly this
aws codepipeline get-pipeline --name
It will get you back a codepipeline resource for cloudformation. You will be able to see where you need to enter in other resources like codebuild projects and s3 buckets or codecommit repos.
Be aware though that you will need to work through the template to ensure it will be taken as valid by cloudformation. The lines of the resource from the cli need to start with capital letters so it can be tedious to change that.
Another thing to know is a pipeline needed I think two roles which you can have in your template also and it's own bucket. All of these things cab be put in a single template making reproducible pipelines possible. Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With