Use EC2 roles and .gitconfig to access codecommit without ssh-keys - Mon, Jan 25, 2016
Create a IAM role for your EC2 instance that has access to your codecommit repository:
{
"Version": "2012-10-17",
"Statement" : [
{
"Effect" : "Allow",
"Action" : [
"codecommit:*"
],
"Resource" : "arn:aws:codecommit:us-east-1:111111111111:MyDemoRepo"
}
]
}
Start an EC2 instance with this role attached
Put the codecommit credential-helper in ~/.gitconfig on the EC2 instance you just started
[credential]
helper = !aws codecommit credential-helper $@
UseHttpPath = true
Clone the codecommit repo
git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo