Database Reference
In-Depth Information
Update table
To update the already created table, DynamoDB provides the UpdateTableRequest
API. Here, you just need to specify the table and the table properties you need to update.
You can update the provision throughput setting or global secondary index. One thing to
note with the API is that it can't be used to add/remove any secondary indexes. The fol-
lowing is the syntax to use:
// Create a provision throughput instance with updated read
and write unit values
ProvisionedThroughput updateProvisionedThroughput = new
ProvisionedThroughput()
.withReadCapacityUnits(30L).withWriteCapacityUnits(30L);
// Create update table request instance and provide the
necessary details
UpdateTableRequest updateTableRequest = new
UpdateTableRequest()
.withTableName("Book")
.withProvisionedThroughput(updateProvisionedThroughput);
Once done, you can call the updateTable method from the DynamoDB client:
UpdateTableResult result =
dynamoDBClient.updateTable(updateTableRequest);
Delete table
The AWS SDK allows us to delete a certain table from DynamoDB using the DeleteT-
ableRequest API. To delete a table, you just need to specify the table name. Please use
this API with care as, once the table is deleted, there is no way to get it back.
DeleteTableRequest deleteTableRequest = new
DeleteTableRequest()
.withTableName("Book");
Once done, you can invoke the deleteTable method from the DynamoDB client,
which would execute the request:
Search WWH ::




Custom Search