Amazon dynamodb DynamoDB/CF-超出订户限制:只能同时创建、更新或删除10个表
我试图使用serverless.yml创建24个DynamoDB表,这时我发现了以下错误。我该如何避免这种情况Amazon dynamodb DynamoDB/CF-超出订户限制:只能同时创建、更新或删除10个表,amazon-dynamodb,amazon-cloudformation,serverless-framework,Amazon Dynamodb,Amazon Cloudformation,Serverless Framework,我试图使用serverless.yml创建24个DynamoDB表,这时我发现了以下错误。我该如何避免这种情况 Serverless: Checking Stack update progress… .................................................................Serverless: Deployment failed! Serverless Error ------------------------------------
Serverless: Checking Stack update progress…
.................................................................Serverless: Deployment failed!
Serverless Error ---------------------------------------
An error occurred while provisioning your stack: TestUserTable
- Subscriber limit exceeded: Only 10 tables can be created,
updated, or deleted simultaneously.
Your Environment Information -----------------------------
OS: linux
Node Version: 6.6.0
Serverless Version: 1.1.0
这似乎是Cloudformation的一个普遍问题,以下是AWS论坛中的一个解决方法:
我尝试添加dependson
,但仍然无法解决问题
我得到以下错误
ServerlessError: Template format error: Unresolved resource dependencies [Dev1ProductTables] in the Resources block of the template
将DependsOn:“DevPolicyTable”
放在引号中也没有任何区别
resources:
Resources:
DevUserTable:
Type: "AWS::DynamoDB::Table"
DependsOn: DevPolicyTable
Properties:
AttributeDefinitions:
- AttributeName: "id"
AttributeType: "S"
KeySchema:
- AttributeName: "id"
KeyType: "HASH"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: "b1-dev-user"
DevPolicyTable:
Type: "AWS::DynamoDB::Table"
DependsOn: DevClaimTable
Properties:
AttributeDefinitions:
- AttributeName: "id"
AttributeType: "S"
KeySchema:
- AttributeName: "id"
KeyType: "HASH"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: "b1-dev-policy"
您正在超过并行创建的表的数量,最简单的修复方法是使用DependsOn。您可以将表依赖项设置到另一个表中,以便在创建依赖表之前不会创建此表 在本例中,表1在表2创建之前不会创建,因此它们不会并行创建
"Table1": {
"Type": "AWS::DynamoDB::Table",
"DependsOn": [
"Table2"
],
"Properties": {
"AttributeDefinitions": [
{
"AttributeName": "key",
"AttributeType": "S"
}
],
"KeySchema": [
{
"AttributeName": "key",
"KeyType": "HASH"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": "2",
"WriteCapacityUnits": "2"
},
"TableName": {
"table1"
}
},
"Table2": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"AttributeDefinitions": [
{
"AttributeName": "key",
"AttributeType": "S"
}
],
"KeySchema": [
{
"AttributeName": "key",
"KeyType": "HASH"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": "2",
"WriteCapacityUnits": "2"
},
"TableName": {
"table2"
}
}
您共享的代码示例中似乎缺少
Dev1ProductTables
。你能分享整个文件并修改格式吗?你有没有想过?我也有同样的问题。使用DependsOn应该会有帮助。您基本上为每个表设置了一个相互依赖的依赖项,并创建了一个链,以便在任何给定的时间点只创建一个表,而不是所有表都并行创建。这应该有帮助。请考虑使用单表设计模式组合表。