How To Create Build Using AWS CodeBuild Service

We can create, configure, and build using AWS codebuild service in AWS. You can integrate with any service provider where you have kept the code. We will create-project in the AWS codebuild.

How To Create Build Using AWS CodeBuild Service: 

First of all, we need to create Bucket to store the build on S3 Storage. Go to the S3 service then Click on “Create Bucket“. 

Check Out: How To Integrate Jenkins With S3 Storage To Send The Build

Once you have given a name then Click on “Next“. The bucket is created as shown below. 

Create a Build Project:

Go to the CodeBuild service then click on a “Build”.

Now click on “Create build project“. we need to give a project name. 

If you want to give a tag, you can do that as well.

We have to provide our project source wherefrom it will pull the code.  We have selected the Github and connected it to the account.

Check Out: How To List Git Remote Branches of Repository From Github

We need to keep it tick on checkbox whenever code will change, it will atomically pull the changes and start rebuilding the build. 

We have to select an environment image where the build will be created. 

Now choose the operating system and the rest of the settings according to yours.

If you have already created a service role, select the “Existing service role” otherwise select “New service role” it will create a new role for you.

You have to give the instruction in the YAML file or you can also give a command to build the file.

If you select “Insert build commands” then put the commands “mvn clean install” if your project is java based.

Check Out: Ubuntu No X11 DISPLAY variable was set, but this program performed

Note: The build won’t be uploaded to the S3 bucket if you use the above option. if it happens, you can create a YAML file as shown below.

We need to define the buildspec.yml file on your project root directory. 

Create Build Using AWS

Now we need to select where the build will be stored. we have selected the S3 storage and give a bucket name.

configure aws codebuild

Select the ZIP format.

how to configure buildspec in aws

If you require to check the logs, you can keep the same settings.

build create aws codebuild

Run the Build:

Click on “Create build project” and go to the “build project” then click on “Start build“.

configure codecommit in aws codebuild

Check Out: Sentrifugo 3.2 Failed To Connect Gmail Account SMTP Issue

Before the above steps, you may need to check the permission on the service role. Click on “Build details” and Scroll down then you will see the “environment“.

aws codebuild create-project

Click on “service role link” and click on the “CodeDeployGit-service-role” and you must see the S3 permissions.

how to configure github in codebuild

Once you have checked the service role polices and now go back to the “CodeBuild” and click on “Start build“.

As you can see, the builds are in process.

create codebuild project

After sometimes, you will see build succeeded.

how to setup codebuild in aws

We need to go to the S3 bucket to check whether we have received the build-in ZIP format. If you have the build, it means this is configured properly and working well.

That’s it. aws codebuild create-project configure

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment