Breaking Down an appspec.yml File

Learn how to write an appspec.yml file for your deployment project.

Overview

The appspec.yml file contains the following:

  • The files that need to be installed on the EC2 instance include the application source code and necessary scripts.

  • The event hooks to run as part of the application deployment lifecycle.

An AppSpec file can be formatted in YAML (YAML Ain’t Markup Language) or JSON (JavaScript Object Notation). For deployments to an EC2 instance, the appspec.yml file needs to be a YAML-formatted file.

The content of the appspec.yml file can be inputted directly into the CodeDeploy console or created as an appspec.yml file at the root of the project’s directory.

The appspec.yml syntax

The general structure of an appspec.yml file is shown below:

Get hands-on with 1200+ tech skills courses.