Components of AppSpec YAML File
Learn about the different components that make up the application specification file.
We'll cover the following...
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.
version: 0.0os: linuxresources:- TargetService:Type: AWS::ECS::ServiceProperties:TaskDefinition: arn-of-task-definitionLoadBalancerInfo:ContainerName: application nameContainerPort: 80files:- source: /destination: /home/ec2-user/serverhooks:ApplicationStart:- location: server_start.shrunas: ec2-userApplicationStop:- location: server_stop.shrunas: ec2-userBeforeInstall:- location: before_install.shrunas: 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. ...