What is AWS CodeCommit?
If you are developing on AWS or any other platform for that matter, you will understand the need for good version control. Git repositories have for a long time been an effective method of controlling software versions, enabling multiple developers to work on the same code base without overwriting each other’s code and providing the opportunity to roll back code in the event of a release introducing unforeseen behaviours, or bugs as they are more commonly referred to.
Amazon CodeCommit is a Git repository but comes with the trademark AWS approach of replication across multiple regions providing a secure, highly available code repository ensuring development of your projects can continue uninterrupted should an availability zone go offline.
CodeCommit removes a lot of manual maintenance tasks related to version control found in some other commercial code management solutions and supports large objects, so can scale along with your code base.
CodeCommit has all your favourite tools and integrations like a CLI interface, compatibility with all the major coding IDEs as well integration with project management applications like Jira.
If you are building application on AWS infrastructure, you will also have the added advantage of integration with your existing AWS account and IAM credentials. CodeCommit also plays well with other AWS services like AWS CodePipeline for capturing version control information and artifacts. CodeCommit makes it as easy to provision a new code repository as it is to provision a new server instance on AWS.
AWS CodeCommit will automatically encrypt your files in transit and at rest and will allow you to store any type and size of file in repositories that do not have size limits. This allows you to store images, libraries and version specific assets along with your code.
AWS CodeCommit starts with a free tier which includes 5 active users, unlimited repositories, 50GB-month of storage and 10,000 Git requests per month
CodeCommit can be found in your AWS management console under Developer Tools.
Creating a CodeCommit Repository
Creating a new CodeCommit repo is extremely simple, just hit the Create repository button:
Creating an IAM user for CodeCommit
When you interact with the repo, you will need to generate a set of Git credentials to associate with your IAM user. This lets you interact with the CodeCommit repository.
For the purposes of this post, we’ll add a new user.
The next step is to make sure the user has permissions to perform codecommit actions. To do this you go to “Attach existing policies directly” and filter on “codecommit”
The next step is to open up the new user in IAM and go to the security credentials tab to set up Git Credentials for AWS CodeCommit.
Under the HTTPS Git credentials for AWS CodeCommit, hit the Generate Credentials button.
Make sure you download the credentials and keep them in a safe place.
Once generated, the Git user credentials maintenance will allow you to make the credentials inactive, reset the password or delete the user.
Armed with your CodeCommit Git credentials you can now clone the repo we created.
Copy the http location of the repo from the CodeCommit console and on you local machine use “git clone” followed by the repo URL to clone the repo locally — then enter the user name and password when prompted.
Now you can perform all the git operations you are familiar with.
We can for instance create or add some files and some code, in this instance there’s a readme and a python script.
You can now use standard git commands
If we issue a “git status” we can see we are on the master branch and no files have yet been committed and we get a list of the files yet to be committed to the repository.
So we can add & commit our two sample files to the local repo using:
Now we can push the repo up to the AWS hosted CodeCommit repository using:
Now when we go back to the AWS CodeCommit console and refresh the screen, the files are now present.
The history of your commits is easily viewed from the console and the commit dashboards, which will give you a history of all the commits pushed up to your CodeCommit repo.
You can dig deeper into the individual code changes contained in a commit by selecting the commit ID, which will show you details related to the files contained in the commit and the lines of code that changed.
We love a good visualization and the CodeCommit dashboard includes a “Commit Visualizer” which shows you a historical timeline of commits with selectable branches. You can select individual commits from the timeline to view the detailed commit information detailed above.
So that’s a high level view of AWS CodeCommit. We have barely scratched the surface and haven’t explored the relationship between CodeCommit and the AWS complimentary products like CodeArtifact, CodeBuild, CodeDeploy and CodePipeline.
If you are building solutions on AWS or GCP and Azure for that matter, once you have your code written and deployed, you will most likely benefit from solid auto generated network infrastructure diagrams, which is where Hava can help.
There are many reasons why you should establish and maintain accurate network diagrams. An AWS Components diagram helps you explain your network design and onboard new engineers and consultants faster. They provide visual clues about network resilience vulnerabilities like what happens when an availability zone goes offline. Hava’s AWS security group diagram will help your security team spot obvious security issues like open ports and understand how traffic traverses your network and applications.
If you haven’t checked out Hava’s auto generated, auto updated cloud infrastructure diagrams yet, you can open a free account here: https://www.hava.io
Originally published at https://www.hava.io.