Introduction
In this article, we will talk about AWS CodeCommit by answering three questions - What, Why, and How. It is always better to understand ‘What’ a service is and ‘Why’ we use it, before going onto ‘How’ to use it.
What is AWS CodeCommit?
AWS CodeCommit is a source and version control service offered by AWS. It is the place to manage our source files centrally and privately. It lets you create repositories to which developers contribute their code. CodeCommit supports git - to manage the administration of files with code commit.
Why Use CodeCommit?
CodeCommit is like any other git tools like GitHub, BitBucket, or GitLab. So why use code commit?
-
It is better to use CodeCommit when you have your build and deployment environment in AWS. If you run Dev, Stage, Prod on AWS using AWS Services, codecommit is the closest GIT repository and an easy to integrate option.
-
Fully Managed - You don't need to Host and manage version control systems. CodeCommit is a AWS managed service , It is scalable, and highly available by default.
-
It works with git tools, so a developer finds no difference while working with codecommit.
-
User Management - Permissions to the repositories in code commit is given through IAM. It eliminates the need to create users in the source control system by leveraging the already existing IAM users.
-
Secure - CodeCommit helps you own private repositories with granular access to them, so it is highly secure.
How to use CodeCommit?
Create Repository
To use CodeCommit and upload source files to it, the first step is to create repositories. Go to
AWS->Services->CodeCommit->CreateRepository
Provide a name to the repository, and the repository will be created.
Provide a name to the repository, and the repository will be created.
Authorization to Repository
Access to CodeCommit Repository is managed by IAM(Identity and Access Management). Create an IAM user if you do not have a user, attach a CodeCommit Policy to it.
In the below example, I have a IAM User Created called RepoUser. There are two ways to attach permissions to this user.
-
Using AWS Managed Policy -

You can attach any one of the above three managed policies to the user.
AWSCodeCommitFullAccess gives complete access to all the repositories present. This policy should be given to the CodeCommit Administrator only.
AWSCodeCommitPowerUser gives all the permissions except deletion of repository.
AWSCodeCommitReadOnly gives only the read permissions
I highly recommend creating a user-based policy rather than using AWS Managed Policy for granular access.
-
Using Custom Policy
A particular user should only be provided access to the repository he is working on. You should always create policies that give limited permission to limited repositories.
For example:
The following policy gives the user all “GET” and “PUT” permissions, except Delete Repository permission to a specific repository - DemoRepository.



Join the conversation! Your thoughts help the community grow.