use of software.amazon.awssdk.services.dynamodb.model.UpdateTableRequest in project aws-doc-sdk-examples by awsdocs.
the class UpdateTable method updateDynamoDBTable.
// snippet-start:[dynamodb.java2.update_table.main]
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!");
}
Aggregations