amazon-web-servicesaws-codebuildaws-codecommit

AWS CodeBuild: Accessing CodeCommit repository in another account?


I have a CodeCommit repo in Account A, that I would like to use as a source provider for my CodeBuild project in Account B.

I have created a Role in Account A with full codecommit access to Account B. I am lost on how to proceed further with this.

How do I use this role that in Account A in my CodeBuild project that is in Account B?


Solution

  • I realised that I cannot do this directly with CodeBuild so I created a CodePipeline, CMK, and an artifact bucket with the necessary permissions for the source code to get uploaded to it first. I followed this blog post to do it through the console and CLI, and then created CF templates for later re-use.

    https://prashant-48386.medium.com/cross-account-codepipeline-that-use-codecommit-from-another-aws-account-9d5ab4c892f6