Amazon cloudformation 具有多个资源的Cloudformation模板

Amazon cloudformation 具有多个资源的Cloudformation模板,amazon-cloudformation,aws-cloudformation-custom-resource,Amazon Cloudformation,Aws Cloudformation Custom Resource,我有一个相当简单的cloudformation模板。我正在努力了解他们。我创建了一个在部署堆栈时尝试创建2 dyanmo表的表。但只创建了一个表。不是两个。我不确定我的语法有什么问题。粘贴下面的json "AWSTemplateFormatVersion" : "2010-09-09", "Resources" : { "resource1" : { "Type" : "AW

我有一个相当简单的cloudformation模板。我正在努力了解他们。我创建了一个在部署堆栈时尝试创建2 dyanmo表的表。但只创建了一个表。不是两个。我不确定我的语法有什么问题。粘贴下面的json

"AWSTemplateFormatVersion" : "2010-09-09", "Resources" : { "resource1" : { "Type" : "AWS::DynamoDB::Table", "Properties" : { "AttributeDefinitions" : [ { "AttributeName" : "Name", "AttributeType" : "S" }, { "AttributeName" : "Age", "AttributeType" : "S" } ], "KeySchema" : [ { "AttributeName" : "Name", "KeyType" : "HASH" }, { "AttributeName" : "Age", "KeyType" : "RANGE" } ], "ProvisionedThroughput" : { "ReadCapacityUnits" : "5", "WriteCapacityUnits" : "5" }, "TableName" : "tablecloudformation3_1" } } }, "Resources" : { "resource2" : { "Type" : "AWS::DynamoDB::Table", "Properties" : { "AttributeDefinitions" : [ { "AttributeName" : "Name", "AttributeType" : "S" }, { "AttributeName" : "Age", "AttributeType" : "S" } ], "KeySchema" : [ { "AttributeName" : "Name", "KeyType" : "HASH" }, { "AttributeName" : "Age", "KeyType" : "RANGE" } ], "ProvisionedThroughput" : { "ReadCapacityUnits" : "5", "WriteCapacityUnits" : "5" }, "TableName" : "tablecloudformation3_2" } } }, } 模板中几乎没有错误。@marainesparnisari已经指出了一点

中间的缺括号和不需要的括号。

我修复了模板,可以确认它是否有效:

模板中几乎没有错误。@marainesparnisari已经指出了一点

中间的缺括号和不需要的括号。

我修复了模板,可以确认它是否有效:

更一般地说,可以帮助更快地捕获这些模板问题,并出现以下错误:

E0000 Duplicate found Resources第35行

更一般地说,可以帮助更快地捕获这些模板问题,并出现以下错误:


E0000 Duplicate found Resources第35行

您有两个键ResourcesTip:YAML格式通常可以避免JSON格式引起的问题。没有那些讨厌的{大括号}!您有两个密钥ResourcesTip:YAML格式通常可以避免JSON格式引起的问题。没有那些讨厌的{大括号}!
{
  "AWSTemplateFormatVersion" : "2010-09-09",
  "Resources" : {
    "resource1" : {
      "Type" : "AWS::DynamoDB::Table",
      "Properties" : {
        "AttributeDefinitions" : [
          {
            "AttributeName" : "Name",
            "AttributeType" : "S"   
          },
          {
            "AttributeName" : "Age",
            "AttributeType" : "S"
          }
        ],
        "KeySchema" : [
          {
            "AttributeName" : "Name",
            "KeyType" : "HASH"
          },
          {
            "AttributeName" : "Age",
            "KeyType" : "RANGE"
          }
        ],
        "ProvisionedThroughput" : {
          "ReadCapacityUnits" : "5",
          "WriteCapacityUnits" : "5"
        },
        "TableName" : "tablecloudformation3_1"
      }
    },
    "resource2" : {
      "Type" : "AWS::DynamoDB::Table",
      "Properties" : {
        "AttributeDefinitions" : [
          {
            "AttributeName" : "Name",
            "AttributeType" : "S"   
          },
          {
            "AttributeName" : "Age",
            "AttributeType" : "S"
          }
        ],
        "KeySchema" : [
          {
            "AttributeName" : "Name",
            "KeyType" : "HASH"
          },
          {
            "AttributeName" : "Age",
            "KeyType" : "RANGE"
          }
        ],
        "ProvisionedThroughput" : {
          "ReadCapacityUnits" : "5",
          "WriteCapacityUnits" : "5"
        },
        "TableName" : "tablecloudformation3_2"
      }
    }
  }
}