AWS Developer Tools Services Part 1: AWS CodeCommit
Introduction
This post is part of my mini-series about AWS Developer Tools Services
- Part 1: AWS CodeCommit
- Part 2: AWS CodeBuild
- Part 3: AWS CodeDeploy
- Part 4: AWS CodePipeline
AWS CodeCommit
I’m looking for GitHub alternatives and thought CodeCommit would be worth a shot.
Creating a Repository
Like any other Git provider, you start with creating a repository.
As a side-note, I always thought what was lacking in GitHub was a way of grouping repositories. You can use topics which are essentially labels
I was hoping there would be a way to create folders or another way to group related repositories together but the closest thing they provide is using tags:
Connecting to repositories
After creating the repository it shows all the information needed for different protocols (HTTPS / SSH) and platforms (MacOS / Windows / Linux). One thing to note is that because of the security risks, it doesn’t allow you to connect with root credentials so you have to be logged in as an IAM user with CodeCommit full access.
I’m writing this blog post on a Windows laptop and so followed this guide for generating public/private keys.
It’s similar to any other Git guide with the exception that you have to add your access key to your SSH config file (~/.ssh/config):
Host git-codecommit.*.amazonaws.com
User APKAEIBAERJR2EXAMPLE
IdentityFile ~/.ssh/codecommit_rsa
Then to test your connection, run:
ssh git-codecommit.us-east-2.amazonaws.com
After adding the host to known hosts list you should see this message:
You have successfully authenticated over SSH. You can use Git to interact with AWS CodeCommit. Interactive shells are not supported.Connection to git-codecommit.us-east-2.amazonaws.com closed by remote host.
Clone the repo
On the same, click on the Clone URL dropdown and choose the protocol you’d like to use (ideally SSH):
and try it in your shell (Powershell in my case). You should see your repository locally:
Troubleshooting
In my experience in Windows, everything worked find on command line but when I tried to use my Git client (Git Extensions) I started having connection issues. The fix for that was to add my AWS SSH Key Id in the URL:
git clone ssh://Your-SSH-Key-ID@git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo my-demo-repo