Connect to CodeCommit and push changes to Git repository

10.1. Your AWS Cloud9 development environment already have IAM credentiales configured, use these credentials with the AWS CLI credential helper. Enable the credential helper by running the following two commands in the terminal of your Cloud9 environment.

git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true

10.2. Inside the Cloud9 environment, go to msg-app-backend folder and remove remote from git project.

cd ~/environment/msg-app-backend/
git remote remove origin

10.3. Use your URL repository to add your new origin.

export MY_REGION=`aws configure get region`
git remote add origin https://git-codecommit.$

10.4. Configure Git with your name and email.

git config --global "Your Name"
git config --global

10.5. Edit the file buildspec.yml and replace <REPOSITORY_URI> with your URI from Amazon ECR Repository and save the file, use the editor included in Cloud9 environment or run the following commands.

export REPOSITORY_URI=`aws ecr describe-repositories --repository-names workshop-api | jq '.repositories[0].repositoryUri' | tr -d \"`
sed -i "s~<REPOSITORY_URI>~$REPOSITORY_URI~g" buildspec.yml

Cloud9 Buildspec

10.6. Push the project to your CodeCommit repository.

git add .
git commit -m "Buildspec"
git push origin master

10.7. Now you can browse the content of your respository

CodeCommit Code