This tutorial aims to get an IAM account setup to be able to use Code Commit. In summary I'm going to be:

  • Create IAM developer group with full permissions to access code commit.
  • Create IAM User and developer group.
  • Setting up SSH keys and configure SSH to use said keys.
  • Try a new repository

That said, lets get started.

Create IAM developer group with full permissions to access code commit.

  • Log into your account
  • Go to IAM > Groups > Create New Group
  • Create a group called Developers
  • Attach AWSCodeCommitFullAccess policy
  • Make sure you download the CSV file with all the given credentials or at least store it somewhere safe

Create IAM User and developer group.

  • Go to IAM > Users > Create New User
  • Create a user, I follow the pattern of first initial and last name (eg. jdoe)
  • Allow Programmatic access and AWS Management Console access
  • Let AWS to Autogenerated password
  • Make sure you require password reset
  • You should be able to see the Developer group you created previously make sure you assign it to the user.

Setting up SSH keys and configure SSH to use said keys.

  • Create your SSH keys by running ssh-keygen -t rsa -b 4096 -C "opposite.bracket@gmail.com"
  • name your ssh keys (eg. aws-id_rsa)
  • Go to AWS > IAM > Users
  • Select the user you created (eg jdoe)
  • Copy your public ssh key by running the following in your terminal pbcopy < ~/.ssh/aws-id_rsa in the terminal
  • Update user in AWS
  • Update your ~/.ssh/config with the following content:

Host git-codecommit.*.amazonaws.com
  AddKeysToAgent yes
  UseKeychain yes
  User {SSH key ID}
  IdentityFile ~/.ssh/aws-id_rsa

Try a new repository

  • Create a repository with your AWS CLI: aws codecommit create-repository --repository-name my-first-repo
  • Clone the repo git clone ssh://git-codecommit.us-west-2.amazonaws.com/v1/repos/my-first-repo
  • Change into repo cd my-first-repo
  • Create a README.md echo '#Provisioning' > README.md
  • commit git commit -am "make first commit"
  • push git push origin master

PROFIT!!!