AWS CodeCommit and git working

What is AWS CodeCommit?

  • CodeCommit is a version control application available on AWS cloud and used to store and manage source code, binary files and configuration files privately and securely in the cloud. In my recent assignment, it is used to store the helm charge, value.yaml and script file to maintain a CICD pipeline.

CodeCommit Key Pointers

  • Fully managed service hosted by AWS to Store your code securely
  • Work collaboratively on code with support of pull requests
  • Easily scale your version control projects with large numbers of files or branches, large file sizes, and lengthy revision histories
  • CodeCommit has no limit on the size of your repositories or on the file types you can store
  • Easily migration support to CodeCommit from any Git-based repository
  • CodeCommit supports Git commands as well as its own AWS CLI commands and APIs

Prerequisites

Install following package on your machine.

  • Python 3+ Download from here
  • PIP, the Python package manager
  • Gitbash – Download from here
  • AWS Session Manager and AWS cli package
  •  Install remote code-commit using pip install git-remote-codecommit

CodeCommit and Git Environment:

Following figure shows the end to end working of git and AWS CodeCommit considering complete CICD pipeline. A developer can add, edit and update the code, binary files and configuration files and commit to local repository and can push to AWS CodeCommit as and when required.

CodeCommit pushes the changes to AWS pipeline and and further to AWS CodeBuild. One binaries are build with necessary libraries and dependencies, it can be forwarded to AWS CodeDeploy to relaunch the cloud native application on EC2 instance.

How does it work?

  • Confirm all above mentioned software packages are installed
  • Update the config and credential file or Configure aws profile using cmd CLI with Access Key ID, Secret Access Key, Region name information provide for repository account. Following picture show how to get this information from aws GUI

  • create a local directory/folder as Local repository
  • open the local repo path in gitbash application
  • git clone the remote codecommit repo to local path using shown command in gitbash command line

  • Once the remote repo is clone to local repo, perform the edit & changes where ever required.
  • Once the changes are completed, do a staging using git status command, which tell what are the changes are done in the repo and untracked changes need to be added to local repo before doing the commit. Below picture show git status and git add command syntax.

  • Once the changes are staged using the git add, user can proceed with the commit using git commit command as shown below. while doing change commit, user should put proper and understandable comment

  • Once commit is successful with now error, user the push the change to remote codecommit repo as shown below

Related Topics:



You may also like...