Is there a best practice or standarized way to clone a git repository (currently using CloudCommit to make permissions easier) into an EC2 instance on startup?
I'm using the userdata section with a cloud-init script that has:
runcmd:
- git clone https://git-codecommit.us-west-2.amazonaws.com/v1/repos/myrepo
But my cloud-init-output.log file shows that the git command could not connect to the server. When I attempt to do it outside of the cloud-init script, I get:
The config profile (default) could not be found
as the error message. So I'm assuming the user that runs the userdata init scripts does not have an aws cli config profile set up and therefore can't run a git clone? What is the proper way to do this? My EC2 instance does have a role that allows it to read from CodeCommit so I shouldn't need SSH keys.