###Line Length A line should be no more than 120 characters long.
###Indentation
- Each indentation should only have 2 spaces
- NO TABS
###White Space
- No empty lines should be present in the template.
- No white space at the end of a line.
There should be no white space between a key and the colon.
Good Example:
{
"key": "value"
}
Bad Example:
{ "key" : "value" }
###Template Layout Every Cloud Formation template should include the following sections:
- AWSTemplateFormatVersion
- Description - This must not be an empty string
- Resources
The Cloud Formation template should be in the following order:
- AWSTemplateFormatVersion
- Description
- Metadata (if applicable)
- Parameters (if applicable)
- Mappings (if applicable)
- Conditions (if applicable)
- Resources
- Outputs (if applicable)
###Lists If the list item is not an integer or a string it must be one item per line.
Ex:
{
"foo": [
"bar", "baz",
]
}
Or
{
"foo": [
{ "Ref": "foobar" },
{ "Ref": "bar" }
]
}
Single item lists should remain on the same line as the opening bracket.
Ex:
{
"foo": [ "bar" ]
}
###References A reference should be declared on a single line unless it exceeds the max line length.
Good Ex:
{ "Ref": "foobar" }
Bad Ex:
{
"Ref": "foobar"
}
###Userdata It is acceptable to have a string and JSON object on the same line if the string is referencing the JSON object as an argument.
Example:
" --foo ", { "Ref": "bar" }