This is a simple flow to allow EC2 instance that has assumed a role with CodeCommit policy to access CodeCommit
- Create EC2 Instance Role with AWSCodeCommitReadOnly policy
- Create EC2 with Amazon Linux AMI that assumes the role
- Install git:
yum install git
- Run
git config --global credential.helper '!aws codecommit credential-helper $@'
- Run
git config --global credential.UseHttpPath true
- Clone your repo