Tuesday, May 1, 2018

Cross account access to AWS CodeCommit

How to access Account A's CodeCommit repository from Account B


Prerequisite:
  • You need to have been granted a Role in Account A as Cross Account access with the necessary permission to access all or specific CodeCommit repository
  • The instruction is meant for access from Windows, adjust accordingly if you are doing this from Linux or Mac

Create an User in your own account with Programmatic Access with (at least) STS:AssumeRole










Download Access Key


  1. Go to IAM >> Users
  2. Go to Security Credentials
  3. Create Access Key

Install AWS CLI and install with default settings

https://aws.amazon.com/cli/

Install git and install with default settings

https://git-scm.com/downloads

You can use this for reference if you are not familiar with git

http://rogerdudler.github.io/git-guide/

Configure AWS CLI

  1. Open Command Prompt (or powershell)
  2. Run aws configure, provide as follows
  3. Go to your personal directory (c:\users\name\.aws) - you will need to show hidden files
  4. Open credentials files in text editor and replace content with following:
  5. AAAAAAAAAA - Account ID of Account A
  6.  99999999999999 - Your Given Role Name in Account A
  7.  xxxxxxxxxxxxx - keys generated from above

Configure Git

  1. Go to your personal directory (c:\users\name) and open .gitconfig in text editor
  2. Make sure your region matches
  3. Open git command prompt and test your connection
  4. Press Cancel when you receive username/password prompt from Git Credential Manager (if installed)






No comments:

Post a Comment

AWS WAF log4j query

How to query AWS WAF log for log4j attacks 1. Setup your Athena table using this instruction https://docs.aws.amazon.com/athena/latest/ug/wa...