AWS CodeBuild

 

AWS CodeBuild is a fully managed build service that compiles source code, runs tests, and produces software packages that are ready to deploy. 

With CodeBuild, you don’t need to worry about provisioning and managing your own building infrastructure. 

You simply provide your build project’s source code and build settings, and CodeBuild handles the rest.

With AWS Code Deploy, you can avoid the manual process of deploying code, reduce the risk of errors and downtime, and improve the overall efficiency of your deployment process.

For example, if you have a web application that you want to deploy, you can use CodeBuild to compile your source code, run unit tests, and produce a deployable package. 

What is Buildspec file for Codebuild?

The Buildspec file is a configuration file used by AWS CodeBuild to define how to build and deploy your application or software project. It is written in YAML or JSON format and contains

  • ·       A series of build commands.
  • ·       Environment variables.
  • ·       Settings.
  • ·       Artifacts that CodeBuild will use during the build process.

I have a Java code under this repo and below is the folder structure.

https://github.com/rajasekarcloud/aws_code_deploy/tree/main


The code is pushed into the code commit repo. Refer to https://rsinfomindss.blogspot.com/2026/04/aws-code-commit-with-git-basics-i.html

Now, we have the code in code commit. Let's see how to build this code into an executable JAR.

Now, navigate to the CodeBuild section of AWS and build project.

Create a build project:

Select the source where the code to build exist:



Select the environment to build the code (EC2 which is self-managed at the backend).



Create a new service role or select an existing role:


Select the “Buildspec” file:

Choose the artifacts (Destination where the build must be stored)




Finally, proceed with the build.


Take a look at the build phase details.



Once the build is completed, the artifact is stored into a S3 bucket.



In the next blog, we will see how to deploy this JAR using EC2 instance.

Comments

Popular posts from this blog

K8s - ETCD

Agentic AI - Series 3

Agentic AI - Series 4