AWS CodeCommit: An AWS integrated solution for your git needs!

Everyone knows about Github and Gitlab but did you know that AWS offers a similar solution for your git needs? Fully integrated into AWS and linked with multiple AWS services is AWS CodeCommit. CodeCommit offers a full git software solution for keeping track of your repositories, viewing your commits, tracking your changes, creating branches and tags, and performing pull requests. All of these features are important for the developer using git as their code repository. Overall AWS CodeCommit offers a fully managed, highly available, secure code repository for all of your development needs.

Integrated right into AWS

Being fully integrated into AWS, CodeCommit provides you the ability to leverage AWS as your code repository instead of having to go to another git hosted service or stand up git yourself. It makes it easier when working with AWS as your development team will only need a single set of login credentials to remember as they’ll be able to access CodeCommit through the browser the same as any other AWS service. Being fully managed, AWS keeps your git repositories up to date with the latest versions of the git software so you don’t have to worry about managing that aspect either as you would with a self hosted solution. Since CodeCommit is built into AWS, your repositories are secure as CodeCommit encrypts your files in transit and at rest. It also provides access controls around your repositories using IAM roles. For those companies looking to store your code securely without the need to self host a solution, AWS CodeCommit is the perfect solution.

CodeCommit also ties directly into the AWS Devops process. Being the first main step in that process, CodeCommit performs the repository tracking feature. By utilizing CodeCommit, it makes it easier to build out the rest of the AWS Devops process.

  1. CodeCommit
  2. CodeBuild
  3. CodeDeploy
  4. CodePipeline

CodeBuild ties directly into the CodeCommit repository for building your applications. Your code is built and packaged and prepared for deployment. All of this can be setup to be automated and feed into your continuous delivery and/or continuous deployment process.

CodeDeploy is the AWS solution for automating the deployment process of your applications.  By using an automated process for deployments, you remove the potential for human errors and gain complete repeatability of your deployments.  You can automate the deployment to your dev environment, run the same deployment in the test environment to confirm it works, and then use CodeDeploy to push the updates to your production environment using a rolling update mechanism that minimizes the downtime of your applications.

CodePipeline provides a continuous delivery service for your applications.  Your application updates are automatically built, tested, and made ready to deploy with the workflow process outlined with CodePipeline.  You are able to model your application release process using the CodePipeline tool and develop the specific workflow steps needed for your release management process.  Within your workflow, you can even add manual approval steps which allow builds to be approved by leadership prior to being released.  The workflow developed within CodePipeline will run on any commit update to your application repository thus running all of the features committed through the workflow pipeline.

Accessing CodeCommit from your git bash

Like all git repositories, you can access AWS CodeCommit from your local git bash or command prompt of choice.  If you are looking to connect over HTTPS, one key thing to do so is that you must first setup your IAM user with the appropriate Git credentials for AWS CodeCommit.  To do so, navigate to the IAM portion of the Services menu within your AWS console.  Then click on the Users page to navigate to where all of the users are listed.  Now either create a new user or click to open up your existing user account.  Transition over to the “Security credentials” tab on the user’s page within IAM.

At the bottom of this tab, you will see the “HTTPS Git credentials for AWS CodeCommit” section.

Here is where you will generate the username and password to use within git.  Click the “Generate” button and it will generate the specific username and password for you.  This username and password will be used within the git bash or command line of your choice to connect to the CodeCommit repositories.  Upon performing your git clone for the repository, enter your username and password just generated and you will be able to utilize CodeCommit for all of your git actions.

Triggers and notifications to automate your repository processes

One important piece of AWS CodeCommit is the ability for you to automate some of your repository processes and notifications.  Utilizing AWS SNS (Simple Notification Service), you are able to setup email notifications to anyone you choose regarding the following:

  • Pull request update events
    • Notify subscribers when a pull request is created, updated, or closed.
  • Pull request comment events
    • Notify subscribers when someone comments on a pull request.
  • Commit comment events
    • Notify subscribers when comments and replies are added to commits.

With triggers in AWS CodeCommit, you are able to send SNS messages or run AWS Lambda functions in reaction to different events:

  • All repository events
  • Push to existing branch
  • Create branch or tag
  • Delete branch or tag

These triggers and notifications can help your development team be alerted quickly to what is going on with the repositories they are working on and allows them to setup webhooks triggered by repository events.

Conclusion

Overall, AWS CodeCommit provides a robust git capability built right into AWS.  If you are already utilizing AWS for your application platform, utilizing AWS CodeCommit and the other continuous delivery services allows for a one stop shop for devops management and operations all within the AWS cloud.