AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Table Of Contents

Feedback

[ aws . cloudformation ]

validate-template

Description

Validates a specified template.

Synopsis

  validate-template
[--template-body <value>]
[--template-url <value>]

Options

--template-body (string)

Structure containing the template body with a minimum length of 1 byte and a maximum length of 51,200 bytes. For more information, go to Template Anatomy in the AWS CloudFormation User Guide.

Conditional: You must pass --template-url or --template-body . If both are passed, only --template-body is used.

--template-url (string)

Location of file containing the template body. The URL must point to a template (max size: 307,200 bytes) located in an S3 bucket in the same region as the stack. For more information, go to Template Anatomy in the AWS CloudFormation User Guide.

Conditional: You must pass --template-url or --template-body . If both are passed, only --template-body is used.

Examples

To validate an AWS CloudFormation template

The following validate-template command validates the sampletemplate.json template:

aws cloudformation validate-template --template-body file:////home//local//test//sampletemplate.json

Output:

{
    "Description": "AWS CloudFormation Sample Template S3_Bucket: Sample template showing how to create a publicly accessible S3 bucket. **WARNING** This template creates an S3 bucket. You will be billed for the AWS resources used if you create a stack from this template.",
    "Parameters": [],
    "Capabilities": []
}

For more information, see Working with AWS CloudFormation Templates in the AWS CloudFormation User Guide.

Output

Parameters -> (list)

A list of TemplateParameter structures.

(structure)

The TemplateParameter data type.

ParameterKey -> (string)

The name associated with the parameter.

DefaultValue -> (string)

The default value associated with the parameter.

NoEcho -> (boolean)

Flag indicating whether the parameter should be displayed as plain text in logs and UIs.

Description -> (string)

User defined description associated with the parameter.

Description -> (string)

The description found within the template.

Capabilities -> (list)

The capabilities found within the template. Currently, CAPABILITY_IAM is the only capability detected. If your template contains IAM resources, you must specify the CAPABILITY_IAM value for this parameter when you use the create-stack or update-stack actions with your template; otherwise, those actions return an InsufficientCapabilities error.

(string)

CapabilitiesReason -> (string)

The capabilities reason found within the template.