AWS

4 Mins Read

AWS CodeBuild: A Fully Managed Build Tool

Integrate Code, Build Artifact, Manage release. If you know the pain of these processes you might need to look at AWS CodeBuild. Maintaining a project developed by many team members concurrently which is composed of different functions, environment, and languages, AWS CodeBuild is here to help you.

AWS CodeBuild is a fully managed service that compiles your source code and gives you a software package which you can directly deploy into your servers. Instead of setting up and scaling your own build server fleet, you can use CodeBuild to streamline your development process. AWS CodeBuild is elastic, scalable, and easy to use. For each build, it launches a fresh, Isolated container-based environment and terminates it after the build process ends. You can also use CodeBuild as AWS CodePipeline Build Provider.

Let’s look at the major Terminologies of AWS CodeBuild.
• Source Repository – Location of your source code.
• Build Environment – Your runtime environment.
• IAM Role – Grants CodeBuild permission to access to specific AWS services and resources.
• Build Spec – Build commands.
• Compute Type – Amount of memory and compute power required.

AWS CodeBuild uses Docker containers to build your code depending on your environment. You can use build environments provided by AWS or existing Docker images from Docker hub or Elastic Container Registry. Currently AWS provides build environments for Java, Android, Ruby, Go, Node.js, Python, and Docker (to build Docker images). All your command line output is streamed into AWS management console during the build process. Let’s go through the build process.

-> Install – Install packages in the build environment if any.
-> Pre-build – Commands that should run before build if any.
-> Build – Commands to build the artifact.
-> Post-build – Commands to run after the build if any.

Here is an example for your buildspec.yml

 

Now, let us see how to build your first project in AWS CodeBuild. I’m going to show you how to build a maven project here. I have my maven code zipped and pushed into S3 Bucket.

Step1: Go to AWS CodeBuild console and create a project.

img2

Step2: Give a project name and a description.

456Step3: Select source provider as S3, select your bucket from the drop-down list and provide your filename.

Step4: Configure your environment to build. Let us use an image managed by AWS.
Select Runtime as Java, and use Java: openjdk-8 as the version. Under Build command gives as mvn clean package.

789Step5: Describe where you need your artifacts to get saved.

10Step6: Select the Service role for your project and click on continue.

11Step7: Click on Save and build to start to build.

img7Step8: This will build your project. To see your build logs from the console.

open the project and select the latest build. Once the project is built successfully you will see your status SUCCEEDED.

13Pricing:

You pay only for the resources you use. You charged for the compute resources you use per minute.

Please write us at forum.cloudthat.com for any queries.

WRITTEN BY CloudThat

SHARE

Comments

  1. santosh

    Aug 12, 2019

    Reply

    how to congfigure service role
    can you please explain?

  2. CarlesCF

    Aug 16, 2017

    Reply

    Hi, I am having problems compiling an Android project because of the SDK license acceptance. When gradle assemble command is running it abruptly ends with a message: “You have not accepted the license agreements of the following SDK components” And then several packages (since I have been changing de SDK version and Android Build Tools version). Is there a way to accept licenses???

  3. meghanasmiley03

    Mar 21, 2017

    Reply

    Nice Post thanks to you for this attractive information.

  4. Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!