Over a million developers have joined DZone.

Getting Started With AWS CodeCommit Repositories

Learn how to use AWS CodeCommit with this quick and easy guide.

· DevOps Zone

Discover how to optimize your DevOps workflows with our cloud-based automated testing infrastructure, brought to you in partnership with Sauce Labs

To create a new CodeCommit version-control repository, go to your AWS console and select CodeCommit under Developer Tools. Click the Create new repository button, enter a unique repository name and a description and click Create repository. Next, you will connect to the repository.


Connect to the CodeCommit Repository 

There are a couple of ways to connect to an existing CodeCommit repository. One is via https and the other via ssh. We’re going to focus on connecting via SSH in this post. For additional information, see Connect to an AWS CodeCommit Repository. The instructions in this section are based on CodeCommit Setup from Andrew Puch.

The first thing you’ll do is create an IAM user. You do not need to create a password or access keys at this time. To do this, go to the AWS IAM console, then the Users section and create a new user. Once you’ve created the new user, open a terminal and type the following. NOTE: These instructions are designed for Mac/Linux environments.

cd $HOME/.ssh ssh-keygen

When prompted after typing ssh-keygen, use a name like codecommit_rsa and leave all fields blank and just hit enter:

cat codecommit_rsa.pub

Go to IAM, select the user you previously created, click on the Security Credentials tab and click the Upload SSH public key button. Copy the contents of the codecommit_rsa.pub to the text box in the Upload SSH public key section and save.

Go back to your terminal and type:

touch config chmod 600 config
sudo vim config

The YOUR_SSH_KEY_ID_FROM_IAM variable below is the row value for the SSH Key Id that you created when uploading the public key. You will replace this placeholder and brackets with the value for the SSH Key Id from the Security Credentials tab for the IAM user you’d previously created.

Host git-codecommit.*.amazonaws.com   User [YOUR_SSH_KEY_ID_FROM_IAM]   IdentityFile ~/.ssh/codecommit_rsa

To verify your SSH connection works, type:

ssh git-codecommit.us-east-1.amazonaws.com

To clone a local copy of the CodeCommit repo you just created, type something like (your region and/or repo name may be different):

git clone ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/codecommit-demo

You’ll be using this local copy of your CodeCommit repo.

Download “The DevOps Journey - From Waterfall to Continuous Delivery” to learn learn about the importance of integrating automated testing into the DevOps workflow, brought to you in partnership with Sauce Labs.

repository ,amazon

Published at DZone with permission of Paul Duvall, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}