Connecting to an AWS CodeCommit Repository Demo
Start course

This course provides you with an introduction to AWS CodeCommit and how it can be used to manage your source code. 

Learning Objectives

  • Understand what the service is and the benefit it provides 
  • Learn the core functionality of the service
  • Learn the important features such as notifications, triggers, and approval rule templates
  • Understand how to use the service

Intended Audience

  • Those who are implementing or managing CI/CD pipelines on AWS
  • Those who want to better understand CodeCommit and how it fits into a software development process
  • Anyone taking an AWS certification, such as the AWS Developer - Associate certification 




In this demo, I’ll be using AWS CodeCommit to create a new Git repository. To do this, I’ll be using an IAM user called CodeCommitUser to create and access my repository. Here in the IAM console, you can see I’ve already created the user and attached the AWS-managed policy CodeCommitFullAccess, which as the name suggests gives you full access to CodeCommit. 

I’ve also already downloaded my access keys for this user and set up my credentials file in my AWS CLI to use these access keys. We can check this in the terminal, by typing in AWS configure and ensuring my access keys for this user are configured. And here they are - looks good. 

Now we can go to the CodeCommit Console. Here, the first thing I’ll do is click on create repository and give my repo a name. In this case, I’ll call it the WebAppRepo. For a description, I’ll say “repository for demo web application”. You can optionally choose to tag your repository using AWS tags, which help you easily find and identify your repositories. You can also use these tags to limit access to your repositories through IAM policies. 

Last, on this page, you can enable Amazon CodeGuru Reviewer access. CodeGuru Reviewer will provide recommendations to improve your Python or Java code. When you create pull requests, it will comment on issues that it finds, for example, if it finds a resource leak or a security issue. 

I won’t be using Python or Java code in this demo, so I’m going to leave this box unchecked, and click “create repository.” 

Next, I’m going to connect to the repository. I’ll be doing this through my terminal, but you can connect through a Git client as well, such as Github Desktop. Fortunately, AWS has given us some instructions on how to connect. I’ll be connecting using the HTTPS method. 

To do this, you’ll need to install git and provide appropriate permissions to your IAM user. I’ve already done both, so all I need to do is copy the git clone command they provide and then paste that into my terminal. 

This time we’ve had success - and it’s asking us for a username and password. What this is referring to is the git credentials you are required to generate for your IAM user. To do this, I’ll go back to the IAM console, click on users, then click on my CodeCommit user. 

From here, I’ll click on the security credentials tab and scroll down until I see HTTPS Git credentials for AWS CodeCommit. From here, I’ll click generate credentials which will provide me a username and password, and then click download. 

I’ll put this username and password into the required fields in my terminal. So for username, I’ll paste in the username provided by the HTTPS Git credentials, and for the password, I’ll paste in the password provided as well. 

It looks like my Git credentials were accepted, and now I just have a warning that our repository is empty. At this point, my CodeCommit repository is set up and I can begin to manage my code. That’s it for this one - I’ll see you next time. 


About the Author
Learning Paths

Alana Layton is an experienced technical trainer, technical content developer, and cloud engineer living out of Seattle, Washington. Her career has included teaching about AWS all over the world, creating AWS content that is fun, and working in consulting. She currently holds six AWS certifications. Outside of Cloud Academy, you can find her testing her knowledge in bar trivia, reading, or training for a marathon.