AWS CodeCommit Introduction - Part 2

In the previous article we looked at a general overview of the AWS CodeCommit service.

In this article we will look at setup and accessing a repository in CodeCommit.

There are several ways to work with CodeCommit:

  • AWS Management Console
  • Use Git credentials with HTTPs
  • Federated Access
  • Temporary credentials
  • Web Identity Provider

This article will use Git credentials and HTTPS

Prerequisites

You will need the following setup in order to follow along with this walkthrough

  • Git version control on you local machine More Info
  • An AWS account with access to IAM credentials More Info

Part 1 - Setting Up Permissions

First we are going to give an existing AWS user the proper policies to access CodeCommit

!! images here

  1. Loging to AWS Management Console
  2. Type 'iam' in the top search bar and select the IAM service from the drop down.
  3. Select 'Users' from the left menu
  4. Select the user you wish to add access to CodeCommit
  5. Make sure the Permissions tab is selected and click add permissions
  6. Select 'Attach existing policies dirctly in the Grant permissions section and type CodeCommit in the section below it.
  7. Click the checkbox next to 'AWSCodeCommitFullAccess'
  8. Click 'Next: Review' in the lower right corner

This will take you back to the Summary page for the user.

Part 2 - Create Git Credentials

  1. Loging to AWS Management Console
  2. Type 'iam' in the top search bar and select the IAM service from the drop down.
  3. Select 'Users' from the left menu
  4. Select the user you wish to add access to CodeCommit
  5. Make sure the 'Security credentials' tab is selected. Scroll down to the 'HTTPS Git credentials for AWS CodeCommit' section and click Generate credentials.
  6. Download the credentials csv some where safe. This will be needed later to connect to the repository

Part 3 - Create a Repository

  1. Loging to AWS Management Console
  2. Type 'codecommit' in the top search bar and select the CodeCommit service from the drop down.
  3. Click 'Create repository'
  4. Give your repository a name and click create in the bottom right corner

This will bring you to a 'Connections steps' page with a green Success bar at the top.

Scroll down to 'Step 3: Clone the repository' and copy the repository location

Part 4 - Connect to the repository

  1. Open terminal and move to the directory that you wish to clone the repository to.
  2. Use the repository address from 'Part 3' to clone the repo. git clone <repo-url>
  3. You will be prompted to enter your git credentials from 'Part 2'
  4. Now, that the repository is cloned to your local machine you can interact with it as you would any other git repository
  5. Add some files, push and confirm in the AWS Management Console