...

/

Components of AppSpec YAML File

Components of AppSpec YAML File

Learn about the different components that make up the application specification file.

AWS CodeDeploy uses a configuration file named appspec.yml to manage each deployment. This deployment file can be written in YAML or JSON. An essential requirement we need to keep in mind is that each deployment must have a unique application specification file.

AppSpec YAML file structure

A common theme we must remember while preparing this configuration file is that it has a series of key-value pairs. Even if the value is of a type string, we don’t need to enclose it in double quotation marks.

Press + to interact
version: 0.0
os: linux
resources:
- TargetService:
Type: AWS::ECS::Service
Properties:
TaskDefinition: arn-of-task-definition
LoadBalancerInfo:
ContainerName: application name
ContainerPort: 80
files:
- source: /
destination: /home/ec2-user/server
hooks:
ApplicationStart:
- location: server_start.sh
runas: ec2-user
ApplicationStop:
- location: server_stop.sh
runas: ec2-user
BeforeInstall:
- location: before_install.sh
runas: ec2-user

version: This is a required section. The default and the only allowed value is 0.0. CodeDeploy will use this value to reference new versions as they modify the specification file.

os: This section specifies the operating system name where the application will be deployed. Possible values are:

  • linux: Represents Ubuntu and Amazon Linux. ...