Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I clone repositories in AWS CodeCommit when using AWS CodeBuild?

My CodeBuild process requires me to clone some supporting libraries from AWS CodeCommit. However, since I don't have my private key on the docker image used by AWS CodeBuild, I get permission errors trying to do the checkout:

agent_1  | Host key verification failed.
agent_1  | fatal: Could not read from remote repository.

Is there a simple, recommended way for AWS CodeBuild to download code from AWS CodeCommit?

like image 696
Jesse Barnum Avatar asked Oct 19 '25 15:10

Jesse Barnum


1 Answers

If you are accessing the Codecommit repository in your account and have access to that repository, then you need to configure the IAM Role attached to the build process to be able to read the remote code commit repository.

During the creation of the build project, an IAM role would have got created with the basic permission settings, or you have would have chosen an existing IAM role.

Either way you need to edit the IAM role and attach the Policy to access the CodeCommit resource for the CodeBuild process to perform the cloning operation.

like image 195
Saurav.Kumar Avatar answered Oct 21 '25 05:10

Saurav.Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!