DynamoDB跨区域复制命令失败:ProvisionedThroughputOverride未生效
我尝试用以下AWS CLI命令将us-west-2区域的非全局DynamoDB表复制到eu-north-1区域:
aws dynamodb update-table \ --table-name DeletedIdentifier \ --region us-west-2 \ --replica-updates '[{\"Create\": {\"RegionName\": \"eu-north-1\", \"ProvisionedThroughputOverride\": {\"ReadCapacityUnits\": \"2000000\"}}}]'
执行后收到错误:
An error occurred (ValidationException) when calling the UpdateTable operation: Failed to perform action due to insufficient TableMaxReadCapacityUnits limits in eu-north-1. Current limit is 2000000 RCU. Requested amount for table or GSI is 5000000 RCU. Please contact https://aws.amazon.com/support for limit change.
明明指定了2000000 RCU,但源表默认是5000000 RCU,为什么ProvisionedThroughputOverride没生效?
问题原因
你的命令仅覆盖了主表的吞吐量配置,但如果源表包含全局二级索引(GSI),这些GSI的吞吐量会默认继承源表的配置(即5000000 RCU),而你未对GSI的吞吐量进行覆盖。错误信息中提到的"Requested amount for table or GSI is 5000000",说明是GSI的请求量触发了目标区域的容量限制。
解决方案
需要在replica-updates的Create结构中,添加GlobalSecondaryIndexes配置,对每个GSI单独设置ProvisionedThroughputOverride。示例命令如下:
aws dynamodb update-table \ --table-name DeletedIdentifier \ --region us-west-2 \ --replica-updates '[{\"Create\": {\"RegionName\": \"eu-north-1\", \"ProvisionedThroughputOverride\": {\"ReadCapacityUnits\": \"2000000\"}, \"GlobalSecondaryIndexes\": [{\"IndexName\": \"YourGSIName\", \"ProvisionedThroughputOverride\": {\"ReadCapacityUnits\": \"2000000\"}}]}}]'
注意事项:
- 替换
YourGSIName为源表中实际的GSI名称;如果有多个GSI,需逐个添加到GlobalSecondaryIndexes数组中。 - 确保主表与所有GSI的吞吐量总和不超过目标区域的
TableMaxReadCapacityUnits限制(当前为2000000),若需要更高总容量,再联系AWS支持调整限制。
内容的提问来源于stack exchange,提问作者Kyle

