检查 DynamoDB 表的当前热吞吐量值后,就可以通过以下步骤对其进行更新:
要使用 DynamoDB 控制台检查 DynamoDB 表的热吞吐量值,请执行以下操作:
登录 AWS Management Console,并打开 DynamoDB 控制台:https://console.aws.amazon.com/dynamodb/
。 -
在左侧导航窗格中,选择 表。
-
在表页面上,选择所需的表。
-
在热吞吐量字段中,选择编辑。
-
在编辑热吞吐量页面上,选择增加热吞吐量。
-
调整每秒读取单位和每秒写入单位。这两个设置定义了表可以立即处理的吞吐量。
-
选择保存。
-
请求处理完毕后,将在热吞吐量字段中更新每秒读取单位和每秒写入单位。
注意
更新热吞吐量值是一项异步任务。更新完成后,
Status
将从UPDATING
变为ACTIVE
。
以下 AWS CLI 示例向您展示如何更新 DynamoDB 表的热吞吐量值。
-
对 DynamoDB 表运行
update-table
操作。aws dynamodb update-table \ --table-name GameScores \ --warm-throughput ReadUnitsPerSecond=12345,WriteUnitsPerSecond=4567 \ --global-secondary-index-updates \ "[ { \"Update\": { \"IndexName\": \"GameTitleIndex\", \"WarmThroughput\": { \"ReadUnitsPerSecond\": 88, \"WriteUnitsPerSecond\": 77 } } } ]" \ --region us-east-1
-
您将收到与以下内容类似的响应。您的
WarmThroughput
设置将显示为ReadUnitsPerSecond
和WriteUnitsPerSecond
。当热吞吐量值正在更新时,Status
将为UPDATING
,当设置了新的热吞吐量值时,则为ACTIVE
。{ "TableDescription": { "AttributeDefinitions": [ { "AttributeName": "GameTitle", "AttributeType": "S" }, { "AttributeName": "TopScore", "AttributeType": "N" }, { "AttributeName": "UserId", "AttributeType": "S" } ], "TableName": "GameScores", "KeySchema": [ { "AttributeName": "UserId", "KeyType": "HASH" }, { "AttributeName": "GameTitle", "KeyType": "RANGE" } ], "TableStatus": "ACTIVE", "CreationDateTime": 1730242189.965, "ProvisionedThroughput": { "NumberOfDecreasesToday": 0, "ReadCapacityUnits": 20, "WriteCapacityUnits": 10 }, "TableSizeBytes": 0, "ItemCount": 0, "TableArn": "arn:aws:dynamodb:us-east-1:XXXXXXXXXXXX:table/GameScores", "TableId": "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "GlobalSecondaryIndexes": [ { "IndexName": "GameTitleIndex", "KeySchema": [ { "AttributeName": "GameTitle", "KeyType": "HASH" }, { "AttributeName": "TopScore", "KeyType": "RANGE" } ], "Projection": { "ProjectionType": "INCLUDE", "NonKeyAttributes": [ "UserId" ] }, "IndexStatus": "ACTIVE", "ProvisionedThroughput": { "NumberOfDecreasesToday": 0, "ReadCapacityUnits": 50, "WriteCapacityUnits": 25 }, "IndexSizeBytes": 0, "ItemCount": 0, "IndexArn": "arn:aws:dynamodb:us-east-1:XXXXXXXXXXXX:table/GameScores/index/GameTitleIndex", "WarmThroughput": { "ReadUnitsPerSecond": 50, "WriteUnitsPerSecond": 25, "Status": "UPDATING" } } ], "DeletionProtectionEnabled": false, "WarmThroughput": { "ReadUnitsPerSecond": 12300, "WriteUnitsPerSecond": 4500, "Status": "UPDATING" } } }
以下 SDK 示例向您展示如何更新 DynamoDB 表的热吞吐量值。