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“.
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.
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.
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.
Now we need to select where the build will be stored. we have selected the S3 storage and give a bucket name.
Select the ZIP format.
If you require to check the logs, you can keep the same settings.
Run the Build:
Click on “Create build project” and go to the “build project” then click on “Start build“.
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“.
Click on “service role link” and click on the “CodeDeployGit-service-role” and you must see the S3 permissions.
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.
After sometimes, you will see build succeeded.
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