It is a version control service, which is hosted and fully managed by Amazon, which can be used to privately store data (documents, binary files, source code) and manage them in the cloud. It offers high scalability, security and helps manage source control service, which is used to host private Git repositories.
It eliminates the requirement for the user to know Git and manage their own source control system or worry about scaling up or down their infrastructure. Codecommit supports all the standard functionalities that can be found in Git, which means it works effortlessly with user’s current Git-based tools.
Features of Codecommit
- User doesn’t need to worry about provisioning hardware, server, scaling or software which must be installed, configured or updated.
- Eliminates the administrative overhead from the user’ end of managing their own software and hardware.
- Provides highly available service, which is durable.
- User’s code is stored securely, since the Codecommit repositories are encrypted.
- Software development team members can work collaboratively on the code.
- Codecommit repositories support pull requests, with the help of which users can review each other’s code, comment on other’s code and apply the changes required before merging them into branches.
- There is a provision of email notifications which sends automatically sends emails to users about pull requests, commits, and comments.
- It is an easy task to scale the version control for projects. Codecommit can handle repos that have large files or branches that have large sizes and a long revision history.
- Anything can be stored in Codecommit repositories at any point in time, irrespective of the size of files or file types.
- Repositories are stored close to production resources in the cloud, due to which the speed and frequency of software development life cycle improves.
- If data from a remote repository is required, it can be easily migrated from any Git-based repository to Codecommit’s repository.
- Codecommit comes with support of Git command, and it can be used with AWS CLI and API as well.
Information regarding a specific repository can be obtained and cloned to the local machine of the user, changes can be made here, and this code can be pushed back to the Codecommit repository.
This can be done from the command line or a GUI based editor could be used. If the user feels that a different AWS service is more suitable for the requirement, it is better to skip Code commit and use other services. If Codecommit is forcefully used, it will degrade the performance of the Codecommit repository.
The below snip shows how Codecommit can be used to create and manage repositories:
Image credit: aws.amazon.com
How is CodeCommit Different from File Versioning in Amazon S3?
CodeCommit is an optimized solution meant to work seamlessly with software development teams. It helps in managing changes in batches, which occurs across multiple files, in addition to changes made by other developers of the team at the same time.
Amazon S3 versioning helps recover past versions of files, and its focus is not on collaborative tracking and maintaining of files, which is what a software development team requires.
Set-up for AWS Codecommit
- Set up for AWS Codecommit
- Sign into AWS Management console.
- The user can upload, add, or edit a file to the repository, from the AWS Codecommit console.
- Configure HTTPS Git credentials for Codecommit, which will set a static username and password, supports all operating system, and is compatible with IDEs and development tools.
- The Codecommit credentials can be managed and viewed from AWS console through the ‘My security credentials’ tab.
Steps to use CodeCommit
Following are the steps:
Create a CodeCommit repository
- Open the CodeCommit console.
- Select the AWS Region wherein you wish to create the repository.
- In the ‘Repositories’ page, click on the ‘Create Repository’.
- On the ‘Create Repository’ page, give a name for the ‘Repository name’. Make sure the name is no longer than 100 characters.
- This is an optional step. In the ‘Description’, provide a description for the repository. This way, other users can identify the aim of creating this repository.
- This is an optional step. Click on the ‘Add tag’ and provide a repository tag, which behaves as an attribute label, and helps organize and manage AWS resources.
- Click on the ‘Create’ button.
Adding files to the repository
Files can be uploaded from the local computer with the help of CodeCommit console.
It can also be uploaded using a Git client, with the help of which a repository can be cloned to the user’s local computer. For this, Git has to be installed on the local computer, and then the CodeCommit repository has to be cloned. Changed can be done on the files present in the local computer, and these changes can be pushed to the repository. Once files have been added to the repository, they can be viewed from the console.
- In the navigation bar of the repository, click on the ‘Code’ button.
- Click on the ‘Add file’ and choose the file which needs to be uploaded, or create one.
- If you wish to add a file from a different branch, select the file from the drop-down list. The default branch is automatically selected for the user.
- Enter the ‘Author name’, and enter an ‘Email address’.
- The ‘Commit message’ is optional.
- Click on the file you wish to upload.
- Enter a ‘Filename’.
Browsing contents of the repository
- The files can be reviewed from the console or the contents of the file can be quickly read.
- This helps the user determine which branch needs to be checked or a local copy of the repository gas to be created.
Creating and collaborating on pull requests
While working with other repository users, the user might wish to collaborate on code as well as review the changes. A pull request can be created so that other users can review and comment on the user’s code. If notifications are set up on the repository, the user of the repository can receive emails regarding the events which take place with respect to the repository.
Before a pull request is created, a branch should be created, which contains the code changes that need to be reviewed.
In this post, we understood how CodeCommit service can be used to create and clone repositories so that users can collaborate and work on writing efficient code.