Z M*_*ars 8 amazon-web-services amazon-dynamodb serverless aws-serverless
所以我在无服务器部署过程中遇到了这个问题:
\nServerlessError: An error occurred: MyDdbTable - Cannot perform more than one GSI creation or deletion in a single update.\nRun Code Online (Sandbox Code Playgroud)\n我的DDB表配置是这样的: \n serverless.yml中的配置
\n AttributeDefinitions:\n - AttributeName: externalId\n AttributeType: S\n - AttributeName: code\n AttributeType: S\n - AttributeName: accountId\n AttributeType: S\n KeySchema:\n - AttributeName: externalId\n KeyType: HASH\n - AttributeName: code\n KeyType: RANGE\n GlobalSecondaryIndexes:\n - IndexName: gsi-account-id\n KeySchema:\n - AttributeName: accountId\n KeyType: HASH\n - AttributeName: code\n KeyType: RANGE\n Projection:\n ProjectionType: ALL\n - IndexName: externalId\n KeySchema:\n - AttributeName: externalId\n KeyType: HASH\n Projection:\n ProjectionType: ALL\n - IndexName: code\n KeySchema:\n - AttributeName: code\n KeyType: RANGE\n Projection:\n ProjectionType: ALL\nRun Code Online (Sandbox Code Playgroud)\n附加信息:
\ngsi-account-id具有两 (2) 个 keySchema,accountId并且codeexternalId和code目标:
\n我的目标是添加这两 (2) 个附加索引(externalId和code),但在进行无服务器部署时,我总是遇到上述问题。
问题:
\n感谢那些在这方面帮助我的人。\xe2\x9d\xa4\xef\xb8\x8f
\nJas*_*rth 17
根据文档向现有表添加全局二级索引
每个 UpdateTable 操作只能创建一个全局二级索引。
您需要添加一个 GSI,部署该更改,然后添加第二个 GSI 并部署它。