AppSpec File structure - Amazon CodeDeploy
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

AppSpec File structure

The following is the high-level structure for an AppSpec file used for deployments to Amazon Lambda and EC2/On-Premises compute platforms.

A value in a YAML-formatted AppSpec file that is a string must not be wrapped in quotation marks ("") unless otherwise specified.

AppSpec file structure for Amazon ECS deployments

Note

This AppSpec file is written in YAML, but you can use the same structure to write one in JSON. A string in a JSON-formatted AppSpec file is always wrapped in quotation marks ("").

version: 0.0 resources: ecs-service-specifications hooks: deployment-lifecycle-event-mappings

In this structure:

version

This section specifies the version of the AppSpec file. Do not change this value. It is required. Currently, the only allowed value is 0.0. It is reserved by CodeDeploy for future use.

Specify version with a string.

resources

This section specifies information about Amazon ECS application to deploy.

For more information, see AppSpec 'resources' section for Amazon ECS deployments.

hooks

This section specifies Lambda functions to run at specific deployment lifecycle event hooks to validate the deployment.

For more information, see List of lifecycle event hooks for an Amazon ECS deployment.

AppSpec file structure for Amazon Lambda deployments

Note

This AppSpec file is written in YAML, but you can use the same structure to write an AppSpec file for a Lambda deployment in JSON. A string in a JSON-formatted AppSpec file is always wrapped in quotation marks ("").

version: 0.0 resources: lambda-function-specifications hooks: deployment-lifecycle-event-mappings

In this structure:

version

This section specifies the version of the AppSpec file. Do not change this value. It is required. Currently, the only allowed value is 0.0. It is reserved by CodeDeploy for future use.

Specify version with a string.

resources

This section specifies information about the Lambda function to deploy.

For more information, see AppSpec 'resources' section (Amazon ECS and Amazon Lambda deployments only).

hooks

This section specifies Lambda functions to run at specific deployment lifecycle events to validate the deployment.

For more information, see AppSpec 'hooks' section.

AppSpec file structure for EC2/On-Premises deployments

version: 0.0 os: operating-system-name files: source-destination-files-mappings permissions: permissions-specifications hooks: deployment-lifecycle-event-mappings

In this structure:

version

This section specifies the version of the AppSpec file. Do not change this value. It is required. Currently, the only allowed value is 0.0. It is reserved by CodeDeploy for future use.

Specify version with a string.

os

This section specifies the operating system value of the instance to which you deploy. It is required. The following values can be specified:

  • linux – The instance is an Amazon Linux, Ubuntu Server, or RHEL instance.

  • windows – The instance is a Windows Server instance.

Specify os with a string.

files

This section specifies the names of files that should be copied to the instance during the deployment's Install event.

For more information, see AppSpec 'files' section (EC2/On-Premises deployments only).

permissions

This section specifies how special permissions, if any, should be applied to the files in the files section as they are being copied over to the instance. This section applies to Amazon Linux, Ubuntu Server, and Red Hat Enterprise Linux (RHEL) instances only.

For more information see, AppSpec 'permissions' section (EC2/On-Premises deployments only).

hooks

This section specifies scripts to run at specific deployment lifecycle events during the deployment.

For more information, see AppSpec 'hooks' section.