【发布时间】:2021-08-29 16:49:57
【问题描述】:
我正在使用serverless 框架为我管理 Lambda、DynamoDB 和 S3 资源的创建。
在 serverless.yml 中,我最初为我的 DynamoDB 表提供了一些读取和写入容量单位。然后,我改成BillingMode: PAY_PER_REQUEST,更新成功。
现在,当我更改了 yaml 文件中的一些其他属性时,serverless deploy 命令抛出以下错误:
An error occurred: UsersTable - Subscriber limit exceeded: Update to PayPerRequest mode are limited to once in 1 day(s). Last update at Sun Jun 13 13:36:16 UTC 2021. Next update can be made at Mon Jun 14 13:36:16 UTC 2021 (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: LimitExceededException; Request ID: S4TQTVVHGVJF66Q9ASJG; Proxy: null).
我的问题,为什么在没有更新的情况下尝试更新 UsersTable。 AFAIK,有变更集,它们检测资源是否有任何更改/更新。我错过了什么吗?
一个后续问题,我如何确保不再发生这种情况,因为我正处于设置基础设施的初始阶段,并且每天都会对 yaml 文件进行大量更新。
作为参考,以下是导致问题的 yaml 文件部分。
resources:
Resources:
UsersTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.usersTableName}
AttributeDefinitions:
- AttributeName: userId
AttributeType: S
KeySchema:
- AttributeName: userId
KeyType: HASH
BillingMode: PAY_PER_REQUEST
【问题讨论】:
-
您是否通过 aws 控制台更新了表的计费模式?
-
没有。我没有。但是,第一次从“Provisioned”更新到“PAY_per_request”时,大约需要 30-40 分钟。
-
请重新检查代码,因为此错误仅在您尝试更改 DynamoDB 表的计费类型时出现。 AWS 允许每天仅更改一次计费类型。
标签: amazon-web-services amazon-dynamodb amazon-cloudformation serverless-framework