CmdID / aws / aws cloudformation
aws cloudformation validate-template
Validates a specified template. AWS CLI reference
1 example 2 options Its page in the AWS CLI reference
Examples
To validate an AWS CloudFormation template
The following validate-template example validates the sampletemplate.json template.
aws cloudformation validate-template --template-body file://sampletemplate.jsonIdentify--template-bodyStructure that contains the template body with a minimum length of 1 byte and a maximum length of 51,200 bytes.Contents of sampletemplate.json:
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS CloudFormation Sample Template S3_Bucket: Sample template showing how to create an 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.",
"Resources": {
"S3Bucket": {
"Type": "AWS::S3::Bucket",
"DeletionPolicy": "Retain"
}
},
"Outputs": {
"BucketName": {
"Value": {
"Ref": "S3Bucket"
},
"Description": "Name of the sample Amazon S3 bucket."
}
}
}
Its output
{
"Description": "AWS CloudFormation Sample Template S3_Bucket: Sample template showing how to create an 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 CloudFormation templates in the AWS CloudFormation User Guide.
Options
--template-bodyStructure that contains the template body with a minimum length of 1 byte and a maximum length of 51,200 bytes.--template-urlThe URL of a file that contains the template body.