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
- Loging to AWS Management Console
- Type 'iam' in the top search bar and select the IAM service from the drop down.
- Select 'Users' from the left menu
- Select the user you wish to add access to CodeCommit
- Make sure the Permissions tab is selected and click add permissions
- Select 'Attach existing policies dirctly in the Grant permissions section and type CodeCommit in the section below it.
- Click the checkbox next to 'AWSCodeCommitFullAccess'
- 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
- Loging to AWS Management Console
- Type 'iam' in the top search bar and select the IAM service from the drop down.
- Select 'Users' from the left menu
- Select the user you wish to add access to CodeCommit
- Make sure the 'Security credentials' tab is selected. Scroll down to the 'HTTPS Git credentials for AWS CodeCommit' section and click Generate credentials.
- Download the credentials csv some where safe. This will be needed later to connect to the repository
Part 3 - Create a Repository
- Loging to AWS Management Console
- Type 'codecommit' in the top search bar and select the CodeCommit service from the drop down.
- Click 'Create repository'
- 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
- Open terminal and move to the directory that you wish to clone the repository to.
- Use the repository address from 'Part 3' to clone the repo.
git clone <repo-url>
- You will be prompted to enter your git credentials from 'Part 2'
- Now, that the repository is cloned to your local machine you can interact with it as you would any other git repository
- Add some files, push and confirm in the AWS Management Console