or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

backup-restore.mddata-operations.mdglobal-tables.mdimport-export.mdindex.mdpartiql.mdtable-management.mdtransactions.md
tile.json

tessl/maven-software-amazon-awssdk--dynamodb

AWS SDK for Java v2 DynamoDB client library for interacting with Amazon DynamoDB NoSQL database service

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/software.amazon.awssdk/dynamodb@2.33.x

To install, run

npx @tessl/cli install tessl/maven-software-amazon-awssdk--dynamodb@2.33.0

index.mddocs/

AWS SDK for Java v2 - DynamoDB

The AWS SDK for Java v2 DynamoDB client provides comprehensive access to Amazon DynamoDB, a fully managed NoSQL database service. This library offers both synchronous and asynchronous APIs for all DynamoDB operations including CRUD operations, batch processing, transactions, PartiQL queries, table management, and advanced features like Global Tables and Streams.

Package Information

  • Package Name: dynamodb
  • Package Type: maven
  • Group ID: software.amazon.awssdk
  • Artifact ID: dynamodb
  • Language: Java
  • Installation: Add to your Maven pom.xml:
<dependency>
    <groupId>software.amazon.awssdk</groupId>
    <artifactId>dynamodb</artifactId>
    <version>2.33.4</version>
</dependency>

Core Imports

import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient;
import software.amazon.awssdk.services.dynamodb.model.*;

Basic Usage

import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.*;
import software.amazon.awssdk.regions.Region;
import java.util.Map;

// Create a synchronous DynamoDB client
DynamoDbClient client = DynamoDbClient.builder()
    .region(Region.US_EAST_1)
    .build();

// Put an item into a table
Map<String, AttributeValue> item = Map.of(
    "PK", AttributeValue.builder().s("user#123").build(),
    "name", AttributeValue.builder().s("John Doe").build(),
    "email", AttributeValue.builder().s("john@example.com").build()
);

PutItemResponse response = client.putItem(PutItemRequest.builder()
    .tableName("Users")
    .item(item)
    .build());

// Get an item from a table
GetItemResponse getResponse = client.getItem(GetItemRequest.builder()
    .tableName("Users")
    .key(Map.of("PK", AttributeValue.builder().s("user#123").build()))
    .build());

Map<String, AttributeValue> retrievedItem = getResponse.item();

Architecture

The DynamoDB client is built around several key components:

  • Client Interfaces: DynamoDbClient (sync) and DynamoDbAsyncClient (async) provide the main entry points
  • Request/Response Models: Strongly-typed request and response objects for all operations
  • Exception Hierarchy: Service-specific exceptions extending DynamoDbException
  • Utility Components: Retry policies, paginators, and waiters for enhanced functionality
  • Builder Pattern: Fluent builders for all request objects and client configuration

Capabilities

Data Operations

Core CRUD operations and advanced data manipulation capabilities for working with DynamoDB items.

// Basic item operations
PutItemResponse putItem(PutItemRequest request);
GetItemResponse getItem(GetItemRequest request);
UpdateItemResponse updateItem(UpdateItemRequest request);
DeleteItemResponse deleteItem(DeleteItemRequest request);

// Query and scan operations
QueryResponse query(QueryRequest request);
ScanResponse scan(ScanRequest request);

// Batch operations
BatchGetItemResponse batchGetItem(BatchGetItemRequest request);
BatchWriteItemResponse batchWriteItem(BatchWriteItemRequest request);

Data Operations

Transactions

ACID transaction support for complex multi-item operations with strong consistency guarantees.

// Transaction operations
TransactWriteItemsResponse transactWriteItems(TransactWriteItemsRequest request);
TransactGetItemsResponse transactGetItems(TransactGetItemsRequest request);

// PartiQL transaction support
ExecuteTransactionResponse executeTransaction(ExecuteTransactionRequest request);

Transactions

PartiQL

SQL-compatible query language support for DynamoDB with batch execution capabilities.

// PartiQL operations
ExecuteStatementResponse executeStatement(ExecuteStatementRequest request);
BatchExecuteStatementResponse batchExecuteStatement(BatchExecuteStatementRequest request);
ExecuteTransactionResponse executeTransaction(ExecuteTransactionRequest request);

PartiQL

Table Management

Complete table lifecycle management including creation, modification, and deletion.

// Table operations
CreateTableResponse createTable(CreateTableRequest request);
DescribeTableResponse describeTable(DescribeTableRequest request);
UpdateTableResponse updateTable(UpdateTableRequest request);
DeleteTableResponse deleteTable(DeleteTableRequest request);
ListTablesResponse listTables(ListTablesRequest request);

Table Management

Backup and Restore

Comprehensive backup and restore capabilities including on-demand backups and point-in-time recovery.

// Backup operations
CreateBackupResponse createBackup(CreateBackupRequest request);
DescribeBackupResponse describeBackup(DescribeBackupRequest request);
DeleteBackupResponse deleteBackup(DeleteBackupRequest request);
ListBackupsResponse listBackups(ListBackupsRequest request);

// Restore operations
RestoreTableFromBackupResponse restoreTableFromBackup(RestoreTableFromBackupRequest request);
RestoreTableToPointInTimeResponse restoreTableToPointInTime(RestoreTableToPointInTimeRequest request);

Backup and Restore

Global Tables

Multi-region replication support for globally distributed applications.

// Global table operations
CreateGlobalTableResponse createGlobalTable(CreateGlobalTableRequest request);
DescribeGlobalTableResponse describeGlobalTable(DescribeGlobalTableRequest request);
UpdateGlobalTableResponse updateGlobalTable(UpdateGlobalTableRequest request);
ListGlobalTablesResponse listGlobalTables(ListGlobalTablesRequest request);

Global Tables

Import and Export

Bulk data import from S3 and export to S3 capabilities for large-scale data operations.

// Import operations
ImportTableResponse importTable(ImportTableRequest request);
DescribeImportResponse describeImport(DescribeImportRequest request);
ListImportsResponse listImports(ListImportsRequest request);

// Export operations
ExportTableToPointInTimeResponse exportTableToPointInTime(ExportTableToPointInTimeRequest request);
DescribeExportResponse describeExport(DescribeExportRequest request);
ListExportsResponse listExports(ListExportsRequest request);

Import and Export

Client Configuration

Synchronous Client

interface DynamoDbClient extends AwsClient {
    static DynamoDbClientBuilder builder();
    String serviceName();
    // All 57 DynamoDB operations...
}

interface DynamoDbClientBuilder {
    DynamoDbClientBuilder region(Region region);
    DynamoDbClientBuilder credentialsProvider(AwsCredentialsProvider credentialsProvider);
    DynamoDbClientBuilder endpointOverride(URI endpointOverride);
    DynamoDbClientBuilder httpClient(SdkHttpClient httpClient);
    DynamoDbClient build();
}

Asynchronous Client

interface DynamoDbAsyncClient extends AwsClient {
    static DynamoDbAsyncClientBuilder builder();
    String serviceName();
    // All 57 DynamoDB operations returning CompletableFuture<T>...
}

interface DynamoDbAsyncClientBuilder {
    DynamoDbAsyncClientBuilder region(Region region);
    DynamoDbAsyncClientBuilder credentialsProvider(AwsCredentialsProvider credentialsProvider);
    DynamoDbAsyncClientBuilder endpointOverride(URI endpointOverride);
    DynamoDbAsyncClientBuilder httpClient(SdkAsyncHttpClient httpClient);
    DynamoDbAsyncClient build();
}

Core Data Types

AttributeValue

Represents a DynamoDB attribute value with support for all DynamoDB data types.

class AttributeValue {
    static Builder builder();
    
    // String value
    String s();
    Builder s(String s);
    boolean hasS();
    
    // Number value  
    String n();
    Builder n(String n);
    boolean hasN();
    
    // Binary value
    SdkBytes b();
    Builder b(SdkBytes b);
    boolean hasB();
    
    // String set
    List<String> ss();
    Builder ss(Collection<String> ss);
    boolean hasSs();
    
    // Number set
    List<String> ns();
    Builder ns(Collection<String> ns);
    boolean hasNs();
    
    // Binary set
    List<SdkBytes> bs();
    Builder bs(Collection<SdkBytes> bs);
    boolean hasBs();
    
    // Map
    Map<String, AttributeValue> m();
    Builder m(Map<String, AttributeValue> m);
    boolean hasM();
    
    // List
    List<AttributeValue> l();
    Builder l(Collection<AttributeValue> l);
    boolean hasL();
    
    // Null
    Boolean nul();
    Builder nul(Boolean nul);
    boolean hasNul();
    
    // Boolean
    Boolean bool();
    Builder bool(Boolean bool);
    boolean hasBool();
}

Exception Handling

Base Exception

class DynamoDbException extends AwsServiceException {
    String getMessage();
    String getErrorCode();
    int statusCode();
    String requestId();
}

Common Exceptions

class ResourceNotFoundException extends DynamoDbException;
class ConditionalCheckFailedException extends DynamoDbException;
class ProvisionedThroughputExceededException extends DynamoDbException;
class ValidationException extends DynamoDbException;
class ThrottlingException extends DynamoDbException;
class InternalServerErrorException extends DynamoDbException;
class TransactionCanceledException extends DynamoDbException;
class TransactionConflictException extends DynamoDbException;
class ItemCollectionSizeLimitExceededException extends DynamoDbException;
class RequestLimitExceededException extends DynamoDbException;

Utility Classes

Retry Policy

class DynamoDbRetryPolicy {
    static RetryStrategy resolveRetryStrategy(SdkClientConfiguration config);
    static RetryPolicy resolveRetryPolicy(SdkClientConfiguration config);  // Deprecated
}

Waiters

interface DynamoDbWaiter extends SdkAutoCloseable {
    static DynamoDbWaiter builder();
    
    WaiterResponse<DescribeTableResponse> waitUntilTableExists(DescribeTableRequest request);
    WaiterResponse<DescribeTableResponse> waitUntilTableNotExists(DescribeTableRequest request);
}

Constants and Enums

Table Status

enum TableStatus {
    CREATING("CREATING"),
    UPDATING("UPDATING"),
    DELETING("DELETING"),
    ACTIVE("ACTIVE"),
    INACCESSIBLE_ENCRYPTION_CREDENTIALS("INACCESSIBLE_ENCRYPTION_CREDENTIALS"),
    ARCHIVING("ARCHIVING"),
    ARCHIVED("ARCHIVED");
}

Comparison Operators

enum ComparisonOperator {
    EQ("EQ"),
    NE("NE"),
    IN("IN"),
    LE("LE"),
    LT("LT"),
    GE("GE"),
    GT("GT"),
    BETWEEN("BETWEEN"),
    NOT_NULL("NOT_NULL"),
    NULL("NULL"),
    CONTAINS("CONTAINS"),
    NOT_CONTAINS("NOT_CONTAINS"),
    BEGINS_WITH("BEGINS_WITH");
}

Stream View Types

enum StreamViewType {
    KEYS_ONLY("KEYS_ONLY"),
    NEW_IMAGE("NEW_IMAGE"),
    OLD_IMAGE("OLD_IMAGE"),
    NEW_AND_OLD_IMAGES("NEW_AND_OLD_IMAGES");
}