HumanGov: Implementation Of Git Repositories For Application And Infrastructure Code Using AWS Code Commit + Proof Of Concept (POC) Process Of Commit, Push And Revert Code Changes

Francisco Güemes
5 min readNov 28, 2023

--

In this project based on a real-world scenario, I implemented Git repositories for application and infrastructure code using AWS CodeCommit, and got hands-on experience with the Proof of Concept (PoC) process of commit, push, and revert code changes.

My mission was to set up a Git repository using AWS CodeCommit for HumanGov, a hypothetical Software as a Service for a governmental organization.

Introduction

In this project I am going to setup two code repositories human-gov-application and human-gov-infrastructure for storing the source code of the organization Humangov. In both cases I will use AWS CodeCommit, the fully managed git repository integrated in AWS.

The Humangov organization has a team of developers that develop a Python app, and a team of DevOps engineers that create and maintain the cloud infrastructure, therefore it is required to have two different repositories to keep things sorted.

As you can see in the infrastructure diagramme, the resources must be created in the us-east 1 region, which is the closest region to the headquarters of Humangov

Step 1: Create two code repositories on AWS Code Commit

In this step I created two code repositories human-gov-application and human-gov-infrastructure . In order to do so, I opened my AWS account and searched for “CodeCommit”

I opened “CodeCommit”, then I clicked on the “Create repository” button.

I created the repository by filling the form. You can see below the details.

With this I created the repository for the human-gov-application . That is it!

To ensure that all worked properly I decided to have a look at the repositories dashboard and check that the repository is effectively there.

After that I repeated the previous steps in order to create the repository for human-gov-infrastructure . You can see the creation details below.

Finally when I inspected the CodeCommit repositories dashboard, both repositories appeared there.

Step 2: Integrate the repositories on AWS Cloud9

In order to integrate the repositories from CodeCommit into Cloud9, I followed these steps.

I searched from “Cloud9” in my AWS account.

Once inside Cloud9, I opened the humangov environment. If you want to learn more about Cloud9 and see the details on the creation of this environment, you can have a look at my article: First steps with AWS Cloud9.

Once I opened the environment I found the welcome screen.

I went to the terminal and executed the following commands:

```
git config --global user.name "Francisco Güemes - DevOps Engineer"
git config --global user.email francisco.guemes@humangov.com
```

To ensure that the git configuration changes took place I listed the configuration with git --list as you can see in the next screenshot.

I checked that aws was installed and then I executed the following configuration commands, despite they were not necessary since the git configuration was already there, but for ilustrative purposes I decide to ran them. These commands configure the AWS CLI credential helper for HTTPS connections:


git config — global credential.helper ‘!aws codecommit credential-helper $@’
git config — global credential.UseHttpPath true

After that I went to the “CodeCommit” dashboard and I copied the HTTPs clone URL of the repository.

I cloned the repository using the URL that I copied with the command:


git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/human-gov-infrastructure

After copying the repository I decided to enter in the newly created directory human-gov-infrastructure and I checked that the directory was a git repository by verifying that it contained a .git directory.

Finally I repeated the entire process in order to clone the repository human-gov-application.


git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/human-gov-application

Summary

The present work showcases you can create git repositories in AWS CodeCommit and how to integrate the repositories into your existing Cloud9 environments.

The article also shows some hands on practice techniques that you can use to double check that it step during the creation and configuration process is executed successfully.

--

--

Francisco Güemes

Java Back End Developer with focus on Cloud & Devops |AWS | Microsoft Azure | Google Cloud | Oracle Cloud