gpt4 book ai didi

aws-cloudformation - 具有多种资源的 Cloudformation 模板

转载 作者:行者123 更新时间:2023-12-03 07:17:59 25 4
gpt4 key购买 nike

我有一个相当简单的 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"    }  }},}

最佳答案

模板中错误很少。 @MariaInesParnisari 已经指出了这一点。

其他的缺少左括号和中间不需要的括号。

我修复了模板并可以确认其有效:

{
"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"
}
}
}
}

关于aws-cloudformation - 具有多种资源的 Cloudformation 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62604789/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com