Voiced by Amazon Polly
AWS CodeCommit is a version control service that privately stores and manages assets such as documents, source code, and binary files in the cloud.
Why do we need AWS CodeCommit?
AWS CodeCommit is a managed source control service that hosts private Git repositories. AWS CodeCommit eliminates needing to manage your source control system or scale its infrastructure.
Pioneers in Cloud Consulting & Migration Services
- Reduced infrastructural costs
- Accelerated application deployment
Benefits of AWS CodeCommit
- Work collaboratively on code
- Easily scale your version control projects
- Store anything, anytime
- Integrate with other AWS and third-party services
- Easily migrate files from other remote repositories
- Use the Git tools
How to set up AWS CodeCommit?
There are three ways we can use AWS CodeCommit:
- AWS Console: We can use the web-based console to perform different actions like creating a repository, a branch, etc.
- Git commands: Use the standard Git commands to manage your code.
- AWS CLI commands: Use the AWS CLI commands to manage your code, branches, and pull requests.
The diagram illustrates how the AWS CodeCommit service works through its CLI/console.
Basic AWS CodeCommit commands
Download and install the standard AWS CLI. We need to execute the “AWS Configure” command to configure the CLI with your secret key and access key for authentication and authorization. Some of the basic commands are:
- AWS CodeCommit Shows the usage of CLI along with different options
- AWS CodeCommit command-name help Shows help of a particular command of AWS CLI
- Create-repository Creates the repository
- List-repositories Shows the list of repositories.
The concepts of the pull request, merging, branch switching, stash, reset, restore, etc., are like git.
Operations on AWS CodeCommit repository (using CLI)
Pre-requisite: AWS CLI should be configured on your machine.
To create repository
aws codecommit create-repository --repository-name MyDemoRepo --repository-description "My demonstration repository" --tags Team=Dev
To fetch a remote Git repository to your local machine, execute the command “git clone”
git clone https://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo
To push code changes from your local repository to the CodeCommit repository
run ‘git push <remote-name> <branch-name>’
To fetch changes from the remote CodeCommit repository to the local repo
execute ‘git pull <remote-name> <branch-name>’
A pull request allows users to review, comment on, and merge code changes from one branch to another. We can use pull requests to collaboratively review code changes for minor changes or fixes, major feature additions, or new versions of the released software.
The pull request will show the difference between the tip of the source branch and the last commit on the destination branch when the pull request is initiated.
Creating pull requests using CLI
aws codecommit create-pull-request --title "some title here" --description "Please review these changes" --client-request-token ‘token123’ --targets repositoryName=MyDemoRepo,sourceReference=some-branch
Commit and branch
Using AWS CLI, we can use the command “create-commit” to create a new commit for the branch. We can use the AWS web console to manage commits and branches. We can use AWS Commit Visualizer to view the history of merges and branches.
Migrate to AWS CodeCommit
We can migrate a Git repository to a CodeCommit repository in multiple ways: cloning it, mirroring it, migrating all or just some of the branches, and so on. We can also migrate local, un-versioned content from a local machine to CodeCommit.
Basic Git commands
Please refer below link for basic Git commands.
Quotas in AWS CodeCommit
Please refer to the below link for more details on quotas
AWS CodeCommit is a great service offered by AWS for managing and versioning the code and other data in the remote repository. Since it provides GUI and CLI commands, similar to git commands, it makes the job easy for IT engineers and developers for continuous integrations.
Making IT Networks Enterprise-ready – Cloud Management Services
- Accelerated cloud migration
- End-to-end view of the cloud environment
CloudThat is an official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner and Microsoft Gold Partner, helping people develop knowledge of the cloud and help their businesses aim for higher goals using best in industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.
Drop a query if you have any questions regarding AWS CodeCommit and I will get back to you quickly.
1. What is AWS CodeCommit?
ANS: – AWS CodeCommit is a version control service that privately stores and manages assets such as documents, source code, and binary files in the cloud.
2. Does it provide GUI or AWS console access to manage repositories?
ANS: – Yes, repositories can be managed using AWS console and Git commands.
3. How to migrate the existing Git repo to AWS CodeCommit?
ANS: – We can migrate a Git repository to AWS CodeCommit repository in multiple ways: cloning it, mirroring it, migrating all or just some of the branches, and so on. We can also migrate local, un-versioned content from a local machine to AWS CodeCommit.
WRITTEN BY Sumeet Agarwal