【问题标题】:Cloudformation template validateCloudformation 模板验证
【发布时间】:2015-02-14 07:54:45
【问题描述】:

根据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": []
}

但是当我把它下载到本地,然后再次测试。

$ 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)

有什么想法吗?

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation aws-cli


    【解决方案1】:

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

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

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

    aws cloudformation validate-template --template-body file://S3_Bucket.template
    

    【讨论】:

    • 您也可以使用相对 URL,只需 file://(不是双斜杠,也不是三斜杠)。
    • 我认为这是新功能。我的答案是4岁。 AWS 必须改进它。
    猜你喜欢
    • 1970-01-01
    • 2016-12-03
    • 2018-06-03
    • 2016-07-11
    • 2018-06-22
    • 2018-06-03
    • 1970-01-01
    • 2017-08-20
    • 2016-09-30
    相关资源
    最近更新 更多