Audvik Labs

What is AWS CodeBuild ?

Introduction

AWS Code Build is a fully managed continuous integration service that compiles source code, runs tests, and produces software packages that are ready to deploy. Build and test code with continuous scaling, with pay as you go pricing across platforms such as Java, Ruby, Python, Android and more.

CodeBuild scales continuously and processes multiple builds concurrently, so builds are not left waiting in a queue.

AWS CodeBuild : Insights

Our first challenge, then, is how to trigger the creation of a new artifact for deployment whenever we check in a releasable change. At a minimum, this requires:

Assembling the executable artifacts themselves. For languages such as Java and C#, this means compiling our applications into executable bytecode. For scripted languages, it might mean writing out dynamically generated configuration files and downloading required dependent packages from a package manager repository (such as NPM for Node.js or Pip for Python).

Validating our code. This most often involves running unit tests to ensure our code changes are sound and don’t introduce nasty regressions before deployment.

Packaging the application. Depending on the target runtime environment, packaging might mean creating a ZIP file of our contents or preparing a Docker container containing a fully configured runtime environment and our application code.

All of this, of course, requires some sort of computing capacity – such as Amazon EC2 instances or Docker containers – that’s configured with the build tools and environments our application framework requires. In the good ol’ days, we’d have to create and configure all of this ourselves and keep it running 24/7 in our data centers – often at considerable expense.

Fortunately, we now have AWS CodeBuild, a continuous integration service that makes automating this process easy and efficient. CodeBuild provides managed compute capacity that we can use to orchestrate a build and packaging process of arbitrary complexity.

Using CodeBuild, we can define a CI process that triggers automatically upon a Git check-in. CodeBuild runs a pre-built Linux or Windows build environment as a Docker image that is terminated immediately after our build completes. This means we only pay for exactly the compute capacity our build requires. We can even supply our own Docker container if our build requires specialized tooling or configuration. Build artifacts can be written out to Amazon S3 and the detailed output from our build process sent to Amazon CloudWatch Logs for analysis and debugging.

Benefits of AWS CodeBuild

•Eliminates the need to set up, patch, update, and manage build servers and software

•Scales up and down automatically to meet your build volume

•Never pay for idle build server capacity

•Create complete, automated software release workflows for continuous integration and delivery

•Bring your own build tools and programming runtimes

We have to do few configurations to create an AWS CodeBuild project. Under the project configuration section, we can specify the name of the project and some descriptions of the project.

The next step is to link the source code with the AWS CodeBuild build project. We can associate AWS CodeCommit, GitHub, BitBucket, or AWS S3 with the AWS CodeBuild project.

After the source code provider and the repository is configured for the AWS CodeBuild project, we can choose how the code is fetched for the build process. There are three options, we can select checkout from a branch or check out from a commit id, or checkout from a git tag.

AWS CodeBuild can be accessed from the:

AWS Console

AWS CLI

Let’s look at the AWS CodeBuild in action using the AWS Console.

AWS CodeBuild in action

For demonstration purposes, we’re going to use the AWS CodeBuild console for managing the CodeBuild service.

Let’s log into the AWS Management Console first to access the CodeBuild service.

Login to AWS Console with your account:

Navigate to the AWS Console and click on “Sign in”

If you don’t have an existing AWS account, click on “Create a Free Account” and complete the account creation wizard to sign up for the free tier with AWS.

Sign into AWS as a root user: If you have a root account, select “Root user”, enter the email, and click on “Next”

After clicking on “Next”, provide the password to log into the AWS Console using a root account.

NOTE: It is not recommended to use the AWS account’s root user for daily use.

Sign into AWS as an IAM user: If you have an “IAM user”, enter the account ID / account alias then click on “Next”

Provide your username and password and click on “Sign in” to continue

Now that we’ve logged into the AWS Management Console, type “codebuild” in the main search bar and click on it

Once you click on “CodeBuild,” you will be directed to the AWS CodeBuild Console main landing page

Conclusion

Every project has its own requirements and every CI/CD is unique. But when you have such great and easy to use tools available for you, you might as well want to make smarter use of them. AWS CodeBuild protects your secrets, automates jobs, reduces chances of error, and saves time and effort. “Pay per minute” is the primary reason why developers consider AWS CodeBuild over the competitors

Leave a comment

Your email address will not be published. Required fields are marked *