AWS CloudFormation
User Guide (API Version 2010-05-15)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

cfn-validate-template

Description

Do a static evaluation of a template.

Note

This command checks the syntatic correctness of the template. It does not do a deep check of resources you have declared. For example, if you have specified an invalid region name, cfn-validate-template will not detect that. Declaration errors of that type can be discovered only creating a stack with the template.

Syntax

cfn-validate-template {-f VALUE | -u VALUE} common-options

Options

NameDescriptionRequired

-f, --template-file

The local path and filename to the template to validate

Type: String

Default: None

One of -f or -u must be specified, but not both.

Conditional

-u, --template-url

The URL of the template to validate

Type: String

Default: None

One of -u or -f must be specified, but not both.

Conditional

Output

If the template is valid, the command returns information about capabilties and parameters defined in the template.

If the template contains capabilities (currently, only IAM capabilities are detected), it returns the following capability information:

CAPABILITIES_REASON  REASON
CAPABILITIES_REASON  Template contains IAM resources
CAPABILITIES  CAPABILITY_NAME
CAPABILITIES  CAPABILITY_IAM
            

If the template contains IAM resource and you use that template with the cfn-create-stack or cfn-update-stack commands, you must specify the CAPABILITY_IAM value for the --capabilities parameter; otherwise, this command returns an InsufficientCapabilities error.

If the template contains parameters, the command returns a table that contains the following parameter information. (If a valid template has no parameters, no output is returned.)

  • PARAMETER_NAME

    Parameter name

  • DEFAULT_VALUE

    If the parameter has a default value, that value is reported.

  • NOECHO

    True if the parameter is declared with the NOECHO property.

  • DESCRIPTION

    Value of the Description property for the parameter.

AWS CloudFormation displays errors on stderr.

Examples

Example Request

This reports the validity for the local file example-template-file.template.

PROMPT> cfn-validate-template --template-file example-template-file.template

PARAMETERS  PARAMETER_NAME     DEFAULT_VALUE          NOECHO
PARAMETERS  WordPressUser      admin                  false
PARAMETERS  WordPressDBName    wordpressdb            false
PARAMETERS  WordPressPwd       password               true
PARAMETERS  AvailabilityZones  us-east-1a,us-east-1b  false
PARAMETERS  GroupSize          2                      false
PARAMETERS  InstanceType       m1.small               false