Cloudformation模板验证

BMW*_*BMW 6 amazon-web-services aws-cloudformation aws-cli

根据aws validate-template,我做了测试,以验证URL和本地文件中的相同模板.

但我得到了不同的输出.

直接从URL测试:

$ aws cloudformation validate-template --template-url https://s3.amazonaws.com/cloudformation-templates-us-east-1/S3_Bucket.template
{
    "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": []
}
Run Code Online (Sandbox Code Playgroud)

但是当我将它下载到本地时,再次测试.

$ wget https://s3.amazonaws.com/cloudformation-templates-us-east-1/S3_Bucket.template

2014-12-16 14:48:27 (11.1 MB/s) - 'S3_Bucket.template' saved [652/652]

$ aws cloudformation validate-template --template-body S3_Bucket.template

A client error (ValidationError) occurred when calling the ValidateTemplate operation: Template format error: JSON not well-formed. (line 1, column 10)
Run Code Online (Sandbox Code Playgroud)

任何的想法?

BMW*_*BMW 9

我现在知道如何解决它.你需要给文件full pathfile:///

aws cloudformation validate-template --template-body file:///home/local/test/S3_Bucket.template
Run Code Online (Sandbox Code Playgroud)

或者使用相对路径(file://而不是file:///):

aws cloudformation validate-template --template-body file://S3_Bucket.template
Run Code Online (Sandbox Code Playgroud)

  • 您也可以使用相对URL,只使用`file://`(不是double,而不是三次斜杠). (3认同)
  • 我认为这是新功能。我的答案是4岁。AWS 必须改进它。 (2认同)