dynamo-db
  1. dynamo-db-configuring-read-and-write-capacity

Configuring Read and Write Capacity - DynamoDB Throughput and On-Demand Capacity

Syntax

DynamoDB provides two options for configuring read and write capacity:

  1. Provisioned throughput capacity: You specify the desired number of read and write capacity units to support your application’s performance requirements.
aws dynamodb update-table \
--table-name <table-name> \
--provisioned-throughput ReadCapacityUnits=<desired-read-capacity-units>,WriteCapacityUnits=<desired-write-capacity-units>
  1. On-demand capacity: You do not need to specify or manage any capacity, and DynamoDB instantly accommodates your workloads.
aws dynamodb update-table \
--table-name <table-name> \
--billing-mode PAY_PER_REQUEST

Example

Suppose we want to update the read and write capacity of a table called my-table. We can increase the read capacity units to 50 and write capacity units to 20 using provisioned throughput:

aws dynamodb update-table \
--table-name my-table \
--provisioned-throughput ReadCapacityUnits=50,WriteCapacityUnits=20

Alternatively, we can switch to using on-demand capacity:

aws dynamodb update-table \
--table-name my-table \
--billing-mode PAY_PER_REQUEST

Output

The output of each of the above commands will be a JSON object describing the updated table's configuration.

Explanation

DynamoDB is designed to scale automatically as your application's demands grow or shrink. Provisioned throughput lets you specify the number of read and write capacity units you want to allocate to your table based on your target performance levels. On-demand capacity eliminates the need for explicit capacity planning. DynamoDB instantly accommodates your workloads as they ramp up or down to any previously unseen level.

Use

You can use these commands to modify the throughput capacity of your DynamoDB tables to meet your application's changing demands. Provisioned throughput may be more appropriate for workloads with predictable patterns of traffic, while on-demand capacity may be a better choice for applications with unpredictable or intermittent traffic.

Important Points

  • You can update the read and write capacity of a DynamoDB table using either provisioned throughput or on-demand capacity.
  • Provisioned throughput lets you specify the desired number of read and write capacity units, while on-demand capacity eliminates the need for explicit capacity planning.
  • When using provisioned throughput, you will be charged based on the provisioned capacity units you specify, while on-demand capacity is billed based on the amount of data stored and the number of read/write requests made.

Summary

DynamoDB lets you configure read and write capacity using either provisioned throughput or on-demand capacity. Provisioned throughput lets you specify the desired number of capacity units, while on-demand capacity eliminates the need for explicit capacity planning. These options can help you optimize your application's performance and save costs by avoiding over-provisioning capacity.

Published on: