AWS CloudFormation Template Formats
You can author AWS CloudFormation templates in JSON or YAML formats. We support all AWS CloudFormation features and functions for both formats, except for AWS CloudFormation Designer. Currently, you can use only JSON-formatted templates with AWS CloudFormation Designer.
When deciding which format to use, pick the format that you're most comfortable working in. Also consider that YAML inherently provides some features, such as commenting, that aren't available in JSON. For example, you can add inline comments to YAML templates, as shown in the following example:
AWSTemplateFormatVersion: "2010-09-09" Description: A sample template Resources: MyEC2Instance: #An inline comment Type: "AWS::EC2::Instance" Properties: ImageId: "ami-2f726546" #Another comment -- This is a Linux AMI InstanceType: t1.micro KeyName: testkey BlockDeviceMappings: - DeviceName: /dev/sdm Ebs: VolumeType: io1 Iops: 200 DeleteOnTermination: false VolumeSize: 20
For more information about the template syntax for each format, see Template Anatomy.
AWS CloudFormation supports the following JSON and YAML specifications:
AWS CloudFormation follows the ECMA-404 JSON standard. For more information about the JSON format, see http://www.json.org.
AWS CloudFormation supports the YAML Version 1.1 specification with a few exceptions. AWS CloudFormation doesn't support the following features:
For more information about YAML, see http://www.yaml.org.