amazon-cloudformation - 具有多种资源的 Cloudformation 模板
问题描述
我有一个相当简单的 cloudformation 模板。我正在努力了解他们。我在部署堆栈时创建了一个尝试创建 2 个 dyanmo 表的位置。但是只创建了一张表。不是两个。我不确定我的语法有什么问题。粘贴下面的json
“AWSTemplateFormatVersion”:“2010-09-09”, “资源” : { “资源1”:{ "类型" : "AWS::DynamoDB::Table", “特性” : { “属性定义”:[ { “属性名称”:“名称”, “属性类型”:“S” }, { “属性名”:“年龄”, “属性类型”:“S” } ], “密钥架构”:[ { “属性名称”:“名称”, “密钥类型”:“哈希” }, { “属性名”:“年龄”, “键类型”:“范围” } ], “预置吞吐量”:{ "ReadCapacityUnits" : "5", “写容量单位”:“5” }, “表名”:“tablecloudformation3_1” } } }, “资源” : { “资源2”:{ "类型" : "AWS::DynamoDB::Table", “特性” : { “属性定义”:[ { “属性名称”:“名称”, “属性类型”:“S” }, { “属性名”:“年龄”, “属性类型”:“S” } ], “密钥架构”:[ { “属性名称”:“名称”, “密钥类型”:“哈希” }, { “属性名”:“年龄”, “键类型”:“范围” } ], “预置吞吐量”:{ "ReadCapacityUnits" : "5", “写容量单位”:“5” }, “表名”:“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"
}
}
}
}
推荐阅读
- sql - 使用 oracle 并行化插入查询的问题
- android - Android Vector:为什么不采用描边颜色?
- javascript - 当使用 Date.now() 生成键时,我不确定如何访问和比较对象
- openacc - OPENACC 如何在#pragma acc 例程中处理库函数
- c++ - C++中的工厂方法模式和数据抽象
- javascript - 当我们使用 if(err) 进行猫鼬查询时,为什么 if 语句中没有条件?
- python - 如何在 Windows 10 操作系统的 python 3.8.3 中完美处理图像?
- themes - Bigcartel, Neat theme, removing grid on the slider
- excel - 使用vba在Excel中对具有特定背景颜色的范围内的行进行排序
- validation - 在 Flutter 中,如何在表单之外(即在提交按钮下方)输出 TextFormField 验证器文本?