CommsCentral

My Technology Adventures

AWS CodePipeline - Cross account deployments with CloudFormation

Posted at: 2018-01-28 @ 13:55:00

I use CodePipeline with CodeBuild a good amount. It is a good "enough" tool and I don't have to run a Jenkins or Bamboo server so that makes me happy.

Recently I started out to build a cross account pipeline, where code would get built in one account, and then deployed to my development, staging and production accounts using CloudFormation.

This was where the trouble started, it is actually, not that straight forward. AWS have documentation on the subject, which is a bit shit frankly.
Then the error messages you receive from CP when this doesn't work, really give zero guidance,

Eventually I managed to get it working and figured I'd write some documentation for myself and so that others attempting this might do it faster and with less frustration than I had.

You can find it over at my github https://github.com/adcreare/cloudformation/tree/master/code-pipeline-cross-account - Code pipeline doesn't support cross account deployments via the console, we are left with either CLI commands or CloudFormation. I want with CloudFormation yml files and this repo contains sample templates, you can use as a starting point for your pipeline.

I also put together a diagram to show how all the pieces connect together, which is the hardest part!! Obviously this can be expanded to N number of accounts by duplicating configuration for additional accounts.
diagram-cross-account-codepipeline.png

Good luck! Once it is working, its great and works as advertised.




© 2015 CommsCentral