Billing

class aws_cdk.aws_dynamodb.Billing(*args: Any, **kwargs)

Bases: object

Represents how capacity is managed and how you are charged for read and write throughput for a DynamoDB table.

ExampleMetadata:

infused

Example:

import aws_cdk as cdk


app = cdk.App()
stack = cdk.Stack(app, "Stack", env=cdk.Environment(region="us-west-2"))

global_table = dynamodb.TableV2(stack, "GlobalTable",
    partition_key=dynamodb.Attribute(name="pk", type=dynamodb.AttributeType.STRING),
    billing=dynamodb.Billing.provisioned(
        read_capacity=dynamodb.Capacity.fixed(10),
        write_capacity=dynamodb.Capacity.autoscaled(max_capacity=15)
    ),
    replicas=[dynamodb.ReplicaTableProps(
        region="us-east-1"
    ), dynamodb.ReplicaTableProps(
        region="us-east-2",
        read_capacity=dynamodb.Capacity.autoscaled(max_capacity=20, target_utilization_percent=50)
    )
    ]
)

Attributes

mode

Static Methods

classmethod on_demand()

Flexible billing option capable of serving requests without capacity planning.

Note: Billing mode will be PAY_PER_REQUEST.

Return type:

Billing

classmethod provisioned(*, read_capacity, write_capacity)

Specify the number of reads and writes per second that you need for your application.

Parameters:
  • read_capacity (Capacity) – The read capacity.

  • write_capacity (Capacity) – The write capacity.

Return type:

Billing