Table capacity modes decide how you pay for and handle the speed of your database. They help you manage costs and performance easily.
Table capacity modes (on-demand vs provisioned) in DynamoDB
CreateTable {
TableName: string,
BillingMode: 'PROVISIONED' | 'PAY_PER_REQUEST',
ProvisionedThroughput?: {
ReadCapacityUnits: number,
WriteCapacityUnits: number
}
}BillingMode can be PROVISIONED or PAY_PER_REQUEST (on-demand).
If you choose PROVISIONED, you must specify ProvisionedThroughput.
CreateTable {
TableName: 'Users',
BillingMode: 'PAY_PER_REQUEST'
}CreateTable {
TableName: 'Orders',
BillingMode: 'PROVISIONED',
ProvisionedThroughput: {
ReadCapacityUnits: 5,
WriteCapacityUnits: 5
}
}This command creates a DynamoDB table named ExampleTable using the on-demand capacity mode. You don't need to set read or write capacity units.
aws dynamodb create-table \ --table-name ExampleTable \ --attribute-definitions AttributeName=Id,AttributeType=S \ --key-schema AttributeName=Id,KeyType=HASH \ --billing-mode PAY_PER_REQUEST
On-demand mode is great for unpredictable workloads but can cost more if traffic is steady and high.
Provisioned mode lets you save money with steady traffic but requires you to guess capacity needs.
You can switch between modes later if your needs change.
Table capacity modes control how you pay and handle traffic in DynamoDB.
On-demand mode charges per request and adjusts automatically.
Provisioned mode requires setting fixed read/write capacity but can save money for steady use.