AWS CodeCommit Tutorial

A jurney to the AWS CI/CD (Part - 1)

AWS CodeCommit Tutorial

Day 50 of #90DaysOfDevOps

Task-01 :

  • Set up a code repository on CodeCommit and clone it on your local.

  • You need to set up GitCredentials in your AWS IAM.

  • Use those credentials in your local and then clone the repository from CodeCommit.

Task-02 :

  • Add a new file from local and commit to your local branch.

  • Push the local changes to the CodeCommit repository.


Task 1

Set up a code repository on CodeCommit and clone it on your local.

  • Search for CodeCommit on the AWS dashboard and click on it.

  • Create repository.

  • Enter the repository name, description (optional), and click on Create.

You need to set up GitCredentials in your AWS IAM.

  • First, attach the AWSCodeCommitPowerUser policy to the IAM user, and click on Next. Before that, if you do not have an existing IAM user then you need to create one and get the access key ID and a secret access key. You can refer the how to create a user and how to get programmatic access.

  • Review it, and click on the Add Permission.

  • Next, in the IAM user dashboard, change the tab to the security credentials, and scroll down to the HTTPS Git credentials for AWS CodeCommit.

  • Click on the Generate credentials. Download it.

  • Go back to codecommit.

Use those credentials in your local and then clone the repository from CodeCommit.

  • After clicking on the repository, you can find the prerequisites; follow them.

  • In my case, I have git installed in my system; second, we have just set up the permission and credentials with the IAM user. However, I do not have AWS CLI installed, so I will install it first.

  • In Ubuntu, we can check whether the AWS CLI is installed or not by just typing aws --version.

  • Now install it.

  • Configure AWS CLI with IAM user credentials.

  • On the repository page, click on clone and select https. It will copy the URL.

  • Open a terminal, command line, or Git shell. Run the git clone command with the HTTPS clone URL you copied to clone the repository. For example, to clone a repository named MyDemoRepo to a local repo named my-demo-repo in the US East (Ohio) Region:

    git clone https://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo my-demo-repo

    The first time you connect, you are prompted for the username and password for the repository.

Task 2

Add a new file from local and commit to your local branch.

  • create a file and commit it.

Push the local changes to the CodeCommit repository.

  • git push origin master


Thank you.