Developer Preview — This documentation covers the AWS SDK for Python, which is in Developer Preview and intended for evaluation and testing only. Do not use it for production workloads. For production applications, use the AWS SDK for Python (Boto3). To understand the differences between the two SDKs, see Choosing the right AWS SDK for Python.
Amazon DynamoDB
This chapter provides runnable examples for common DynamoDB workflows — creating tables, reading and writing items, running queries, and coordinating batch operations and transactions. Each example uses the SDK's asynchronous DynamoDB client with typed inputs and outputs, so you can adapt them to your application without translating from raw JSON. Start here to install the client package and configure shared setup that the remaining pages build on.
Install the DynamoDB client before running the asynchronous examples on this page:
python -m pip install aws-sdk-dynamodb
Set up the examples
The client that is used in the following examples can be created from the following snippet by calling client = await create_client() from your asynchronous code. Use the client as an asynchronous context manager, or call await client.close() after the last operation, as described in Creating a service client. When you resolve the generated asynchronous configuration with resolve(), the SDK reads the AWS Region from standard AWS settings, such as environment variables and shared AWS configuration files. The SDK also reads credentials from the same settings. Configure both before running the examples: if no Region is configured, resolve() fails before the client is created, and if no credentials are configured, requests fail when the SDK signs them. For more information about the Region and other settings, see Configuration variables. For how the SDK finds credentials, see Credential providers.
Imports
from aws_sdk_dynamodb.client import AsyncDynamoDBClient from aws_sdk_dynamodb.config import AsyncDynamoDBConfig
Code
async def create_client() -> AsyncDynamoDBClient: config = await AsyncDynamoDBConfig.resolve() return AsyncDynamoDBClient(config=config)