- Navigate to IAM within the AWS Console.
- Create a new user. For this example instructions, we'll set the username to be
test-user-dev
. For AWS access type, just check theProgrammatic access
checkbox. - Create a new group to use for developers to have access to one or more repositories. For this example, we'll create a new group called
dev-team
. Attach theAWSCodeCommitPowerUser
policy to this new group. - Click through the other defaults to create the new user.
-
Just selecting defaults is fine, but for this example we'll name the key
id_codecommit_rsa
.cd ~/.ssh ssh-keygen
-
Copy the SSH public key to your clipboard using xclip.
sudo apt update && sudo apt upgrade -y sudo apt install xclip xclip -selection clipboard < ~/.ssh/id_codecommit_rsa.pub
-
Back in IAM, look up
test-user-dev
. On the Security Credentials tab, click Upload SSH public key. Paste in the details from you clipboard in and save the details. -
Copy the
SSH key ID
generated for you to be used in the final step.
-
Add the host to you SSH configuration.
echo ' Host git-codecommit.*.amazonaws.com User <<The SSH key ID you received once you copied your public key into AWS>> IdentityFile ~/.ssh/id_codecommit_rsa' >> ~/.ssh/config
-
Do a sanity check by running
ssh git-codecommit.us-east-1.amazonaws.com
to ensure your account works. -
Now you should be able to clone your Code Commit Git repositories. As an example:
# This is only an example: git clone ssh://git-codecommit.us-east-2.amazonaws.com/v1/repos/my-test-repo