DEV Community

Harry Patel
Harry Patel

Posted on

AWS CodeCommit - setting up SSH

AWS CodeCommit is basically Github on AWS but it's private, and for sole devs is essentially free.

To set up your identity, just as with Github, you can use HTTPS or SSH. In order to use SSH, I'd recommend setting up a new key pair and so this is what I did on my mac.

  • Open a terminal on your machine and navigate to the ssh folder e.g.

cd ~/.ssh

  • Create a new RSA key pair into a dedicated file. Note this format was known to work with Github, CircleCI, Digital Ocean and AWS.

ssh-keygen -f ./codecommit -m PEM -t rsa -C 'your-email-for@commit-messages'

  • Copy it to your clipboard

pbcopy < ./codecommit.pub

  • Login to your AWS account and visit the code commit security credentials page.
  • Click "Upload SSH public key" and paste
  • It will save it and display a "SSH Key ID". Copy this - this is Your-IAM-SSH-Key-ID
  • Back to your terminal, see if you have a ~/.ssh/config file

ls -la

  • If you do, edit it, if not create and edit it and enter the following:

Host git-codecommit.*.amazonaws.com
User Your-IAM-SSH-Key-ID
IdentityFile ~/.ssh/codecommit

You should now be able to use your ssh credentials to work with CodeCommit

Top comments (0)