CloudFormation / Client / validate_template

validate_template#

CloudFormation.Client.validate_template(**kwargs)#

Validates a specified template. CloudFormation first checks if the template is valid JSON. If it isn’t, CloudFormation checks if the template is valid YAML. If both these checks fail, CloudFormation returns a template validation error.

See also: AWS API Documentation

Request Syntax

response = client.validate_template(
    TemplateBody='string',
    TemplateURL='string'
)
Parameters:
  • TemplateBody (string) –

    Structure containing the template body with a minimum length of 1 byte and a maximum length of 51,200 bytes.

    Conditional: You must pass TemplateURL or TemplateBody. If both are passed, only TemplateBody is used.

  • TemplateURL (string) –

    Location of file containing the template body. The URL must point to a template (max size: 460,800 bytes) that is located in an Amazon S3 bucket or a Systems Manager document. The location for an Amazon S3 bucket must start with https://.

    Conditional: You must pass TemplateURL or TemplateBody. If both are passed, only TemplateBody is used.

Return type:

dict

Returns:

Response Syntax

{
    'Parameters': [
        {
            'ParameterKey': 'string',
            'DefaultValue': 'string',
            'NoEcho': True|False,
            'Description': 'string'
        },
    ],
    'Description': 'string',
    'Capabilities': [
        'CAPABILITY_IAM'|'CAPABILITY_NAMED_IAM'|'CAPABILITY_AUTO_EXPAND',
    ],
    'CapabilitiesReason': 'string',
    'DeclaredTransforms': [
        'string',
    ]
}

Response Structure

  • (dict) –

    The output for ValidateTemplate action.

    • Parameters (list) –

      A list of TemplateParameter structures.

      • (dict) –

        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. If your template contains IAM resources, you must specify the CAPABILITY_IAM or CAPABILITY_NAMED_IAM value for this parameter when you use the CreateStack or UpdateStack actions with your template; otherwise, those actions return an InsufficientCapabilities error.

      For more information, see Acknowledging IAM resources in CloudFormation templates.

      • (string) –

    • CapabilitiesReason (string) –

      The list of resources that generated the values in the Capabilities response element.

    • DeclaredTransforms (list) –

      A list of the transforms that are declared in the template.

      • (string) –