For cloud developers to implement CI/CD, AWS provides various tools. One of them is AWS CodeCommit. AWS CodeCommit is a fully managed service that is used to host secure and highly scalable Git repositories as it is compatible with them. These repositories make it easy for developers to collaborate on code and eliminate the requirement of operating a control system. AWS CodeCommit can be used to store code, binaries, images, etc. It supports the standard functionality of Git so it can be used with your existing Git based tools.
It has a source control system for your software projects. It is a service where you make changes for your code. Any changes that you commit to CodeCommit will trigger down into the CI/CD process.
What is Git?
Git is an industry standard, distributed, and open source version control system that is free to use. It is designed to handle small to very large projects efficiently.
Benefits of AWS CodeCommit
Let’s have a better look at the benefits provided by CodeCommit listed below:
Use a Fully Managed Service
It offers high availability, fault tolerance and is managed by AWS.
Secure Code Storage
CodeCommit repositories are encrypted both in transit and at rest.
CodeCommit supports pull requests, letting developers comment on each other’s code before merging it to branches. Additionally, notifications are sent about pull requests to users and has many other features.
Scale Version Control Projects
CodeCommit repositories can scale up to meet the requirements of development.
CodeCommit repositories have no limit of capacity. You can also store any file there.
Use the Git Tools
CodeCommit supports Git commands as well as AWS CLI commands or APIs.
Working of CodeCommit
The people who are familiar with Git repositories will find CodeCommit similar. However, for those who are not familiar with Git, CodeCommit is simple. The users of CodeCommit are provided with a console to easily create repositories and see the existing repositories with few simple steps. Users can see the information about a repository or clone it to their local computer to make a local repository where they can perform changes on the code and push it back to the CodeCommit repository. CodeCommit can be accessed by a CLI or a GUI-based editor.
1. Use AWS CLI or AWS CodeCommit to create a CodeCommit repository.
2. From your development computer, use Git and run git clone, specify the name of the CodeCommit repository. This will create a local repo that is connected to the AWS CodeCommit repository.
3. You can modify the files in this local repository; then run git add to stage these files. Run git commit to commit the files locally and then, run git push to send the files to CodeCommit repository.
4. Download changes from other users and run git pull to synchronize the files in the CodeCommit repository with your local repo. This ensures that you are working with the latest version of the files.
An enterprise has its online website for selling items, currently it is hosted on its on-premises SCM and facing the following issues:
Repository lacked backup
Difficulty in adding new users to on-premises
Repository lacked clustering capabilities
The operational burden is really high
By using AWS CodeCommit service, the enterprise can migrate all of the repositories and also move some private files in it without any size limit. Also, hosting, maintenance and scaling, or backing up is managed by AWS CodeCommit.
- Log in to AWS Management console and go to “CodeCommit”.
- Click on “Create repository”.
- Enter the repository name and click “Create”.
- Now, your repository has been created.
The IAM user has the following permissions as shown in the below image.
For using the repository, we need Git credentials. Go to the user and generate HTTPS Git credentials. Then, save these credentials as they are needed when using the command line.
5. Go to the CodeCommit console and copy the URL for the cloned repository.6. Go to the command line. First, identify the git version and then copy the link for the cloned repository.7. When it starts cloning, you are required to enter the credentials that you previously generated.8. Your repository has now been cloned in the system. Go to the repository directory by “cd <repository name>”.9. Initially, this directory is empty, so we must push the files from Github repository.10. To get the files in your local system, type “wget <github link>”.Go to the folder where this zip file is cloned and unzip that folder. Delete the zip folder. 11. As we want to push all files in AWS CodeCommit, type command “git add –A”.12. Type “git commit –m “initial import of file” for importing the files. Then, type “git push” to push all these files into AWS CodeCommit.13. Go to CodeCommit console. Here, you can see the repository and inside this repository, all files exist.14. Similarly, commit code for CodeBuild.
As so you can see, it is an ideal choice for any organization to have development tools on AWS. It should be the first choice when you want to host your private Git repositories with minimal cost. With AWS CodeCommit, the third-party version control need is eliminated. It is one of the version code and source control storage service provided by AWS. This service can be integrated with many other tools in order to make the building process easier. It is also helpful to put repositories closer to production resources in AWS to make the development cycle speedy.