Registry / aws / aws-cdk-aws-dynamodb

aws-cdk-aws-dynamodb

JSON →
library1.204.0pypypi✓ verified 85d ago

The CDK Construct Library for AWS::DynamoDB provides high-level constructs for defining Amazon DynamoDB tables in AWS CDK applications. Version 1.204.0 is part of the AWS CDK v1 (maintenance mode). Releases follow the CDK release cadence. Note: v1 is in maintenance; prefer CDK v2.

pip install aws-cdk-aws-dynamodb==1.204.0
INSTALL
IMPORT
SIG · AWS-CDK-AWS-DYNAMO
A
aws-cdk-aws-dynamodb
awspythonv1.204.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Table
from aws_cdk.aws_dynamodb import Table
from aws_cdk.aws_dynamodb import TableProps
TableProps is a different construct; Table is the main resource.

Creates a DynamoDB table with a simple partition key and on-demand billing.

import aws_cdk as cdk from aws_cdk.aws_dynamodb import Table, Attribute, AttributeType, BillingMode class MyStack(cdk.Stack): def __init__(self, scope: cdk.App, id: str, **kwargs): super().__init__(scope, id, **kwargs) Table(self, 'MyTable', partition_key=Attribute(name='id', type=AttributeType.STRING), billing_mode=BillingMode.PAY_PER_REQUEST) app = cdk.App() MyStack(app, 'MyStack') app.synth()
cdk --version
Debug
Known issues
breakingCDK v1 entered maintenance on June 1, 2022, and will end support on June 1, 2023. New features and updates are not released. Migrate to CDK v2.
fix
Upgrade to aws-cdk-lib (v2) by changing imports: from aws_cdk.aws_dynamodb import ... (works in both v1 and v2 but v2 requires aws-cdk-lib).
affects: >=1.0.0
breakingIn CDK v2, this library is included in aws-cdk-lib. Installing aws-cdk-aws-dynamodb separately is not supported and may cause conflicts.
fix
Use from aws_cdk.aws_dynamodb import ... after installing aws-cdk-lib.
affects: >=2.0.0
gotchaIf you set point_in_time_recovery to True without specifying a billing mode, the table defaults to PROVISIONED with a default read/write capacity (5 each), which may incur costs.
fix
Explicitly set billing_mode to BillingMode.PAY_PER_REQUEST to avoid unexpected charges.
affects: *
deprecatedThe attribute 'ttlAttribute' has been deprecated. Use 'time_to_live_attribute' instead.
fix
Use time_to_live_attribute='timetolive' when defining the table.
affects: >=1.90.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'aws_cdk.aws_dynamodb'
Missing package installation or using CDK v2 without aws-cdk-lib installed.
fix
For CDK v1: pip install aws-cdk-aws-dynamodb. For CDK v2: pip install aws-cdk-lib.
jsii.errors.JSIIError: Cannot use "aws-cdk-aws-dynamodb" module without "aws-cdk" module
Required dependency aws-cdk.core not installed.
fix
Install core: pip install aws-cdk.core (or for v2, install aws-cdk-lib).
jsii.errors.JSIIError: Resource of type 'AWS::DynamoDB::Table' already exists in stack
Two table constructs with the same logical ID in the same stack.
fix
Ensure each table has a unique logical ID (e.g., by using different construct IDs).
Upgrade
Version history
1.204.0latest on PyPI · released Jun 19, 2023
Audit
Dependencies
aws-cdk-librequiredCore CDK library, but v1 uses separate packages. For v1, you need aws-cdk.core and aws-cdk.aws-dynamodb.
Agent activity
20 hits · last 30 days
node
18
Resources
aws-cdk-aws-dynamodb — pip install aws-cdk-aws-dynamodb · libregistry