How to Setup your first AWS CodeCommit Repository

Reading Time: 4 minutes

Hello Readers! In this blog we will see how we can easily set up our first AWS CodeCommit Repository in a few steps. Before getting started we will see when we use the AWS code commit repository. So, the answer is CodeCommit Repository minimizes our efforts to manage your own source control system. And here we don’t have to worry about scaling its infrastructure. 

Therefore With the AWS CodeCommit repository we can do everything which we can do with git repository.

So, let’s dive into it!

Step1: You must have a user account with full admin access to it. Therefore, I have created here a IAM user with full admin access.

It has full access as you can see here.

Step2 : Login to this user account that you have created and open CodeCommit from the AWS Management console.

So, now you don’t have any repositories at this moment. Now, we will create a repository. 

Click on Create Repository. Give here your repo name as your wish. Description is optional if you want to give then you can. Tags are also optional, but it’s a good practice to tag all your resources in AWS.

Step3 : Click on Create. 

Now a repository is successfully created as you can see below.

Ways to Access CodeCommit repositories:

So, there are basically two ways to access your repository from the terminal.

  1. HTTPS

We will see now how we can connect via https protocol to our repository.

First step is to generate a git username and password. Go to your IAM user. Select your username. 

 Click on Security credentials and move to HTTPS git credentials for AWS CodeCommit. Click on Generate credentials.

Your credentials are now generated. Copy somewhere your username and password. Or you can download your credentials also.

Secondly Copy your http url for your repository from here.

And open your terminal for accessing your repository.

I have now cloned my repo by generating username and password. And I can access it.

Lets create a file and push it into our repo.

So, we can see here the changes in the CodeCommit repository.

But it’s a little painful. Everytime you need a username and password if you are using https protocol. So, it’s not an ideal way to interact with CodeCommit. 

  1. SSH

Here SSH provides an easy way to interact with it without username and password. So, For this we will create a SSH key by using this command.

Cat the public file and copy the whole key.

Open your IAM user and click on upload SSH public key. Paste here the whole key.

Click on Upload SSH public Key. This is your SSH key ID.

Paste these in your config file inside SSH.

Run this command as per your region for configuring.

So, Now you can easily clone your repository without any username and password.

Copy the link from here.

Congrats! 👏 We are successfully done now!

Conclusion

Thank you for sticking to the end.So, If you like this blog, please do show your appreciation by giving thumbs ups and share this blog and give me suggestions on how I can improve my future posts to suit your needs. Follow me to get updates on different technologies.

Written by 

Naincy Kumari is a DevOps Consultant at Knoldus Inc. She is always ready to learn new technologies and tools. She loves painting and dancing.