Building a sample NodeJS application using AWS CodeBuild via Buildspec.yml
In the previous recipe, we saw how to build the application using AWS CodeBuild. However, in that case, we used the build commands (mvn install
) in the console only, as shown in the following image:

When it comes to the complex scenario, it means we need more than one build commands and need to perform some additional operations in the build environment. For this, we use the buildspec.yml
file.
Buildspec.yml
A build spec is a collection of build commands and related settings; in the YAML format, AWS CodeBuild is used to run a build. This file needs to be checked in with the root
folder of the application code. This file will possess Build steps as well as other things. So, let's see the syntax of buildspec.yml
file.
Syntax
Build specs must be expressed in the YAML format:
version: 0.2 env: variables: key: "value" key: "value" phases: install: commands: - command ...