gpt4 book ai didi

amazon-dynamodb - 全局二级索引 `ProvisionedThroughput` 属性的无服务器 DynamoDB 资源定义错误

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

我正在使用serverless framework我的 serverless.yml 中的 GSI 定义遇到了一个非常奇怪的问题。当我使用原来的定义时:

resources:
Resources:
GPSTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: joined
AttributeType: S
- AttributeName: serial
AttributeType: S
- AttributeName: timestamp
AttributeType: S
KeySchema:
- AttributeName: serial
KeyType: HASH
- AttributeName: timestamp
KeyType: RANGE
GlobalSecondaryIndexes:
- IndexName: ValidGPSIndex
KeySchema:
- AttributeName: joined
KeyType: HASH
- AttributeName: timestamp
KeyType: RANGE
Projection:
NonKeyAttributes:
- Altitude
- Altitude_Unit
- Checksum
- Fix_Quality
- GPS_Time
- HDOP
- Height_of_GEOID
- Height_of_GEOID_Unit
- Latitude
- Latitude_Direction
- Longitude
- Longitude_Direction
- No_of_Tracked_Satellites
- Time_Since_Last_DGPS_Update
ProjectionType: INCLUDE
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5

sls deploy 命令给出以下错误:

ProvisionedThroughput error - property empty

因此,我更改了 serverless.yml 并在 GSI 上添加了适当的 ProvisionedThroughput 属性,如下所示:

      ...
GlobalSecondaryIndexes:
- IndexName: ValidGPSIndex
KeySchema:
- AttributeName: joined
KeyType: HASH
- AttributeName: timestamp
KeyType: RANGE
Projection:
NonKeyAttributes:
- Altitude
- Altitude_Unit
- Checksum
- Fix_Quality
- GPS_Time
- HDOP
- Height_of_GEOID
- Height_of_GEOID_Unit
- Latitude
- Latitude_Direction
- Longitude
- Longitude_Direction
- No_of_Tracked_Satellites
- Time_Since_Last_DGPS_Update
ProjectionType: INCLUDE
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
...

现在,运行 sls deploy 会出现以下错误:

ProvisionedThroughput property unsupported error

有人知道如何正确部署我的表吗?不幸的是,我有点无法使用无服务器框架,尽管我认为在紧急情况下我可以将其转换为 SAM 应用程序。我想先看看社区可以提供哪些帮助。谢谢。

最佳答案

您只是遇到了缩进问题。 ProvisionedThroughput 属性是索引的一部分,而不是Projection

关于amazon-dynamodb - 全局二级索引 `ProvisionedThroughput` 属性的无服务器 DynamoDB 资源定义错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67048280/

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