gpt4 book ai didi

amazon-dynamodb - cloudformation 模板可使用 dynamodb 资源中 GSI 的新非关键属性进行更新,而无需删除 GSI 并再次将其添加回来

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

我想通过 cloudformation 将新的非关键属性更新到现有的 GSI 中。目前,当我想要添加新的非关键属性时,我需要取消配置 GSI 并使用新的和现有的非关键属性重新配置它。有没有办法添加非关键属性而无需每次都取消配置 GSI?

资源:

DynamoDB 表:

Type: "AWS::DynamoDB::Table"
Properties:
TableName: "employee table"
AttributeDefinitions:
- AttributeName: "CustomerId"
AttributeType: "S"
- AttributeName: "empId"
AttributeType: "S"
- AttributeName: "Date"
AttributeType: "N"
KeySchema:
- AttributeName: "CustomerId"
KeyType: "HASH"
ProvisionedThroughput:
ReadCapacityUnits: 20
WriteCapacityUnits: 20
GlobalSecondaryIndexes:
- IndexName: "ByempId"
KeySchema:
- AttributeName: "empId"
KeyType: "HASH"
- AttributeName: "Date"
KeyType: "RANGE"
Projection:
NonKeyAttributes:
- "status1"
- "status2"
- "status3"
ProjectionType: INCLUDE
ProvisionedThroughput:
ReadCapacityUnits: "20"
WriteCapacityUnits: "20"

如果我想添加新的 NonKeyAttributes status4,我需要注释掉从 GlobalSecondaryIndexes 到模板末尾的行,并提供所有 NonKeyAttributes (status1,2,3,4)

最佳答案

不支持更新 GSI,如 docs 中所述。 :

Updates are not supported. The following are exceptions:

If you update only the provisioned throughput values of global secondary indexes, you can update the table without interruption.

You can delete or add one global secondary index without interruption. If you do both in the same update (for example, by changing the index's logical ID), the update fails.

如您所见,您可以删除并创建新的 GSI,但不能更新现有的 GSI。

关于amazon-dynamodb - cloudformation 模板可使用 dynamodb 资源中 GSI 的新非关键属性进行更新,而无需删除 GSI 并再次将其添加回来,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66801856/

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