xxxxxxxxxx
public static void updateDynamoDBTable(DynamoDbClient ddb,
String tableName,
Long readCapacity,
Long writeCapacity) {
System.out.format(
"Updating %s with new provisioned throughput values\n",
tableName);
System.out.format("Read capacity : %d\n", readCapacity);
System.out.format("Write capacity : %d\n", writeCapacity);
ProvisionedThroughput tableThroughput = ProvisionedThroughput.builder()
.readCapacityUnits(readCapacity)
.writeCapacityUnits(writeCapacity)
.build();
UpdateTableRequest request = UpdateTableRequest.builder()
.provisionedThroughput(tableThroughput)
.tableName(tableName)
.build();
try {
ddb.updateTable(request);
} catch (DynamoDbException e) {
System.err.println(e.getMessage());
System.exit(1);
}
System.out.println("Done!");
}
https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/examples-dynamodb-tables.html