AWS CodeCommit is AWS’s own Git offering. It operates primarily on IAM users, so an important part of setting up CodeCommit is to first create IAM user(s).

  • Login to AWS Console as the root user.
  • Create a new repo at CodeCommit.
  • Create and commit a simple new file, say, README.md.
  • Create an IAM user with two important credentials:
    • AWSCodeCommitPowerUser policy.
    • Enable console access.
    • (Remember to download the generated IAM credentials as CSV)
  • Logout of AWS Console.

Now that the IAM user has been created, the following steps are to be completed by the IAM user instead of the root user.

  • Login as the new IAM user.
  • Browse to IAM->Users->(the new IAM user)->Security Credentials->SSH keys for AWS CodeCommit->Generate.
    • (It is usual to see red permission warnings along the way, no worries)
    • Remember to download the generated CodeCommit credentials as CSV.
  • Still as the IAM user, browse to CodeCommit and locate the correct repo.
  • Copy the HTTPS clone URL.
  • On your local Git client (e.g., GitHub client, VS Code), clone the repo using the copied clone URL.
    • When prompted for username and password, use the set of CodeCommit credentials that was download as CSV. Do not confuse that with the earlier set of IAM credentials.
    • If using git command line, git clone https://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo my-demo-repo
  • And that’s it!

Leave a comment