April 8, 2024

AWS CodeCommit — Version control for beginners

The best time to establish protocols with your clients is when you onboard them.


Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Nowadays, software development is a field where speed is crucial. Let’s look at Continuous Integration and Continuous Deployment (CI/CD), two ground-breaking methodologies that have completely changed how teams create, test, and publish apps. This is not merely a tweak, but a revolution in the speedy and smooth deployment of software.

Continuous Integration and Continuous Deployment(CI/CD)

Lets see, what is CI/CD ?

CI/CD: The goal of continuous integration and delivery (CI/CD) as a software development methodology is to automate the integration, testing, and deployment of code changes to production environments.

Continuous Integration(CI) — It is a development practice where code changes are automatically tested and integrated into a shared repository.

Continuous Deployment(CD) — Automates the process of deploying applications to various environments.

We will examine how AWS CodeCommit functions for the CI/CD process below.

AWS CodeCommit — Is a fully-managed source control solution that simplifies the hosting of safe, expandable Git repositories for teams. And facilitates collaboration by offering a safe and highly accessible repository for your codebase, regardless of the size of the project — from tiny projects to massive business applications.

Key features — Fully managed, Scalable, Secure and compliant, Flexible integrations.

AWS Codecommit for Continuous Integration(CI)

We can preserve code quality, speed up development cycles, and guarantee early bug identification. Its effectiveness comes from having a scalable, fully-managed system that lets teams concentrate only on writing code.

AWS CodeCommit Service’s Console

Within the AWS CodeCommit console, Source, Artifacts, Build, Deploy, Pipeline, and Settings sections are located on the left side.

  1. Source Code Repository: To host your source code, use AWS CodeCommit as your Git-based version control repository.
  2. Artifacts: Can be prepared for deployment can be created via CodeBuild.
  3. Build Automation: Configure Amazon CodeBuild to automate the build process. CodeBuild has the ability to generate artifacts, build and compile the program, and download your CodeCommit source code. Include automated testing in your CodeBuild process to ensure the quality of your code.

Let’s explore the ‘Source’ area in more detail. Approval template and repositories are available here.

Steps to set up a code repository on CodeCommit

  1. Create git credentials — Go to the CodeCommit service by opening the AWS Management Console.
  2. In source, Select ‘Repositories’. To create a repository, Click the “Create Repository” button there.

3. A dialogue window will appear after selecting “Create repository”.

4. Once the details are filled in, Click the ‘Create’ button to get started.

5. Repository creation is now successful. Additionally, the repository contains a number of parts, including Code, Branches, Git tags, Commits, Pull requests, and Settings.

6. The option to copy the URL is visible at the right end. We are able to clone on our local system using that URL.

Note: To manage the user’s accessibility, we can establish IAM Access policies.

Clone it on our local machine

  1. Run the git command “git clone <Copied URL>” in an open terminal.

2. Successfully cloned the empty repository. We have installed NodeJS ( JavaScript runtime environment).

3. Now we can initial push for ‘master’.

Branches Management

  1. Proceed to the Branches section. The available branches for our repositories are displayed here.

2. From the console itself, we can also create a branch. We can use the “Create branch” button on the right.

3. Give it a name now, and then create it using the reference branch.

4. We may utilize this branch locally, modify it, and then push it out globally.

Merge Requests in Version Control

  1. Now we have made some changes and pushed it globally.
  2. To generate pull requests, use the ‘generate pull request’ button on the right.

3. To determine whether a branch may be combined, we can select the source and destination branches to compare.

4. We can compare the changes between the source and destination branches. The system checks if the changes in the source branch can be merged into the destination branch without conflicts. This comparison allows you to review the modifications and ensure a smooth merge before completing the pull request.

5. A pull request has been successfully created. To execute actions like merging, searching for modifications, approving rules, and committing, click on our pull request.

6. We can see the ‘Merge’ button on the right. There are three possible strategies to accomplish this fusion, depending on our goals.

  • Fast-Forward Merge: Moves the target branch pointer forward if no divergence occurred.
  • Squash Merge: Condenses source branch commits into a single commit for a cleaner history.
  • 3-Way Merge: Utilizes a common ancestor commit to merge changes from both branches, resolving conflicts if needed.

7. The ‘Delete source branch’ checkbox allows us to remove the source branch following a successful merge.

8. We have used the “Fast forward merge” technique to combine our “sampleBranch” and “master.”

Tracking Code History

  1. Commits — You may view all of the commits made to our repository in this section..
  2. We have a commit Visualizer to examine. Consequently, if you had several commits, they would show up here. further Compere commits in the section on compare commits. It is possible to contrast one branch with another.

Configuration and Preferences

  1. Settings — There are a few tabs in this section, including General, Notifications, Triggers, and Repository tags. CodeGuru Reviewer on Amazon.
  2. The repository’s details are available on the General tab.

3. Notification, We can create notifications for every events which we can perform with in the repository.

4. We can choose to use AWS Chatbot to send notifications to a Slack channel that you’ve linked with AWS Chatbot, rather than utilizing an SNS topic. As a result, we can get alerts straight into your Slack workspace.

5. Activators: Amazon SNS and AWS Lambda are the two events that set off this service.

Approval rule templates

There are preset rules that outline the prerequisites for accepting or rejecting modifications made in the course of a pull request. These templates aid in automating the process of code review. AWS offers pre-configured templates for approval rules that address typical cases, such needing a certain amount of approvals or identifying whether certain file patterns are present. It is also possible to construct custom approval rule templates to customize the review procedure to meet project-specific needs.

April 9, 2024
min read
Subscribe to our newsletter
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Share this article:

More articles