share code commit repositories between aws accounts


Hi team, I have 3 AWS accounts: DEV, STG and PROD

my code commit repositories are in the DEV account.

I don't want to duplicate those repositories on the STG and PROD accounts.

So that my repositories in the DEV account be the single point of truth. and I can be able to create a release from the STG or the PROD using the DEV repositories.

Is there a best way/architecture to achieve this? without doing a workaround on the build spec (like using keys and doing git pull ... on the build spec of STG and PROD).

I followed points 1 and 2 o this tutorial :

after that, I can see DEV repositories in PROD account with switch role but I can't create a codeBuild/ code pipeline project ... because the role switched give only permission to DEV repos, but I want to create the codeBuild in PROD not DEV using the DEV repos (even I give to the role switched more permissions the codeBuild created from PROD was actually created in DEV not in PROD)

Just want to create a new code deploy for fargate in PROD that relies on tags / repos generated from DEV account, so when creating the code deploy in PRD account I can select DEV repos/ tags as source.

can we use the RAM service to share repos ? appreciate any help.

1 Answer


Yes this is a possible use case. You can create CodeBuild or CodePipeline in Prod or Stg account, and reference to the Repo in Dev account. To do this, you would need a role created in Dev account which can be assumed by Prod or Stg account. See this blog for your reference.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions