Skip to content

CodeCommit as a global service

0

Hi,

I want to create a pipeline in ap-south-1 region. Source is a codecommit that is in us-east-1 region.I want the pipeline in ap-south-1 to access repo which is in us-east-1. I know we can configure cross-region setup for builds & deploys OR we can do code-replication for ap-south-1 region, but this not good since we need to wait for the replication to complete before we can trigger the pipeline.

Is there a more elegant way to achieve this?

2 Answers
0

hello,

Use CodePipeline's Cross-Region Support

AWS CodePipeline supports cross-region pipelines. You can create a pipeline in ap-south-1 and add a source action that points to the CodeCommit repository in us-east-1.

To do this:

  1. Create a new pipeline in ap-south-1.
  2. Add a source action of type "AWS CodeCommit".
  3. In the "Repository" section, select "Another AWS account" and enter the repository details (repository name, account ID, and region: us-east-1).
  4. Configure the authentication method (e.g., IAM role).

IAM Permissions:

Ensure the IAM role used by the pipeline has the necessary permissions:

- codecommit:GitPull
- codecommit:BatchGetRepositories
EXPERT
answered a year ago
  • Hi Sandeep, Thanks for your response. I have gone through above steps but the is no option to select the repo from another account. I have tried to create pipeline Create a new pipeline in ap-south-1. Add a source action of type "AWS CodeCommit". In the "Repository" section, select "Another AWS account" and enter the repository details please let me know if I am missing any thing.

  • use this method once hope it works

    Using AWS CLI:

    1. Create a new pipeline:

    bash aws codepipeline create-pipeline --pipeline-name <pipeline-name> --role-arn <IAM-role-ARN> --artifact-store <artifact-store> --region ap-south-1

    1. Create a source stage with CodeCommit repository from another account:

    bash aws codepipeline create-pipeline --pipeline-name <pipeline-name> --stage-configuration [ { "Name": "Source", "Actions": [ { "Name": "CodeCommit_Action", "ActionTypeId": { "Category": "Source", "Owner": "AWS", "Provider": "CodeCommit" }, "RunOrder": 1, "Configuration": { "RepositoryName": "<repo-name>", "BranchName": "<branch-name>", "OAuthToken": "", "PollForSourceChanges": "true", "CrossAccount": "true", "Account": "<another-account-ID>" } } ] } ]

    Replace <pipeline-name>, <IAM-role-ARN>, <artifact-store>, <repo-name>, <branch-name>, and <another-account-ID> with your values.

0

Hello.

As stated in the document below, source actions (such as CodeCommit) do not support cross-region actions.
https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-cross-region.html

You cannot create cross-Region actions for the following action types:

  • Source actions
  • Third-party actions
  • Custom actions

To support cross-region deployment, CodeCommit and CodePipeline must be created in the same region, and CodeDeploy must be created in another region.
In other words, in your case, CodeCommit is located in us-east-1, so you need to configure CodePipline to be created in us-east-1 and CodeDeploy to be created in ap-south-1.

EXPERT
answered a year 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.