Components of a Buildspec YAML File

Learn about the different components that make up a build specification file.

AWS CodeBuild can be used to build and test application code. It maintains all the build commands and the related software that needs to be downloaded in a separate specification file in YAML format. This build specification file can be included in the application’s source code, or it may be generated automatically when a CodeBuild project is built.

Buildspec YAML file name and location

The default name for the build specification file is buildspec, which is expected to be in YAML format. Project teams can change this default name while building the CodeBuild project either from the Management Console or using AWS CLI. AWS CodeBuild expects this file to be present at the root location of the project. Like the buildspec file name, the project teams can customize its location too. The only restriction enforced by AWS CodeBuild is that a project can have one buildspec file only.

Buildspec YAML file structure

Here is the sample buildspec.yaml file:

Get hands-on with 1400+ tech skills courses.