CtrlK
BlogDocsLog inGet started
Tessl Logo

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

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

Overview
Eval results
Files

import-export.mddocs/

Import and Export

Bulk data import from S3 and export to S3 capabilities for large-scale data operations. These features enable efficient data migration, backup to external storage, and integration with data processing pipelines.

Capabilities

Import Table

Creates a new DynamoDB table by importing data from Amazon S3.

/**
 * Imports table data from an S3 bucket
 * @param request - The request containing import configuration
 * @return Response containing import description
 */
ImportTableResponse importTable(ImportTableRequest request);

class ImportTableRequest {
    static Builder builder();
    
    /** Providing a ClientToken makes the call idempotent */
    String clientToken();
    Builder clientToken(String clientToken);
    
    /** The S3 bucket that provides the source for the import */
    S3BucketSource s3BucketSource();
    Builder s3BucketSource(S3BucketSource s3BucketSource);
    
    /** The format of the source data */
    InputFormat inputFormat();
    Builder inputFormat(InputFormat inputFormat);
    
    /** Additional properties that specify how the input is formatted */
    InputFormatOptions inputFormatOptions();
    Builder inputFormatOptions(InputFormatOptions inputFormatOptions);
    
    /** Represents the properties of the table created for the import operation */
    TableCreationParameters tableCreationParameters();  
    Builder tableCreationParameters(TableCreationParameters tableCreationParameters);
}

class S3BucketSource {
    static Builder builder();
    
    /** The S3 bucket that is being imported from */
    String s3Bucket();
    Builder s3Bucket(String s3Bucket);
    
    /** The key prefix shared by all S3 Objects that are being imported */
    String s3KeyPrefix();
    Builder s3KeyPrefix(String s3KeyPrefix);
    
    /** The account number of the S3 bucket that is being imported from */
    String s3BucketOwner();
    Builder s3BucketOwner(String s3BucketOwner);
}

class TableCreationParameters {
    static Builder builder();
    
    /** The name of the table created as part of the import operation */
    String tableName();
    Builder tableName(String tableName);
    
    /** The attributes of the table created as part of the import operation */
    List<AttributeDefinition> attributeDefinitions();
    Builder attributeDefinitions(Collection<AttributeDefinition> attributeDefinitions);
    
    /** The primary key and optionally the secondary indexes of the table created as part of the import operation */
    List<KeySchemaElement> keySchema();
    Builder keySchema(Collection<KeySchemaElement> keySchema);
    
    /** The billing mode for the table created as part of the import operation */
    BillingMode billingMode();
    Builder billingMode(BillingMode billingMode);
    
    /** Represents the provisioned throughput settings for a specified table or index */
    ProvisionedThroughput provisionedThroughput();
    Builder provisionedThroughput(ProvisionedThroughput provisionedThroughput);
    
    /** The global secondary indexes (if any) on the table created as part of the import operation */
    List<GlobalSecondaryIndex> globalSecondaryIndexes();
    Builder globalSecondaryIndexes(Collection<GlobalSecondaryIndex> globalSecondaryIndexes);
    
    /** Represents the settings used to enable server-side encryption */
    SSESpecification sseSpecification();
    Builder sseSpecification(SSESpecification sseSpecification);
}

class ImportTableResponse {
    /** Represents the properties of the table created for the import operation */
    ImportTableDescription importTableDescription();
}

class ImportTableDescription {
    /** The Amazon Resource Number (ARN) corresponding to the import request */
    String importArn();
    
    /** The status of the import */
    ImportStatus importStatus();
    
    /** The table name of the table created as part of the import operation */
    String tableName();
    
    /** The Amazon Resource Number (ARN) of the table being imported into */
    String tableArn();
    
    /** The parameters for the new table that is being imported into */
    TableCreationParameters tableCreationParameters();
    
    /** The S3 bucket that provides the source for the import */
    S3BucketSource s3BucketSource();
    
    /** The format of the source data */
    InputFormat inputFormat();
    
    /** The time when this import task began */
    Instant startTime();
    
    /** The time at which the creation of this import task completed */
    Instant endTime();
    
    /** The number of items successfully imported into the new table */
    Long importedItemCount();
    
    /** The number of errors that occurred during the import */
    Long errorCount();
    
    /** The client token that was provided for the import task */
    String clientToken();
}

Usage Example:

import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.*;
import java.util.List;

DynamoDbClient client = DynamoDbClient.builder().build();

// Import data from S3 to create a new table
ImportTableResponse response = client.importTable(ImportTableRequest.builder()
    .clientToken("import-products-" + System.currentTimeMillis())
    .s3BucketSource(S3BucketSource.builder()
        .s3Bucket("my-data-bucket")
        .s3KeyPrefix("dynamodb-exports/products/")
        .build())
    .inputFormat(InputFormat.DYNAMODB_JSON)
    .tableCreationParameters(TableCreationParameters.builder()
        .tableName("Products-Imported")
        .attributeDefinitions(List.of(
            AttributeDefinition.builder()
                .attributeName("productId")
                .attributeType(ScalarAttributeType.S)
                .build()
        ))
        .keySchema(List.of(
            KeySchemaElement.builder()
                .attributeName("productId")
                .keyType(KeyType.HASH)
                .build()
        ))
        .billingMode(BillingMode.PAY_PER_REQUEST)
        .sseSpecification(SSESpecification.builder()
            .enabled(true)
            .sseType(SSEType.KMS)
            .build())
        .build())
    .build());

ImportTableDescription importDesc = response.importTableDescription();
System.out.println("Import started: " + importDesc.importArn());
System.out.println("Status: " + importDesc.importStatus());
System.out.println("Target table: " + importDesc.tableName());

Describe Import

Retrieves information about a table import operation.

/**
 * Describes an import task
 * @param request - The request containing import ARN
 * @return Response containing import description
 */
DescribeImportResponse describeImport(DescribeImportRequest request);

class DescribeImportRequest {
    static Builder builder();
    
    /** The Amazon Resource Name (ARN) associated with the table import */
    String importArn();
    Builder importArn(String importArn);
}

class DescribeImportResponse {
    /** Represents the properties of the table created for the import operation */
    ImportTableDescription importTableDescription();
}

List Imports

Lists all import tasks for the current account.

/**
 * Lists completed imports within the past 90 days
 * @param request - The request containing filtering options
 * @return Response containing list of imports
 */
ListImportsResponse listImports(ListImportsRequest request);

class ListImportsRequest {
    static Builder builder();
    
    /** An optional string that, if supplied, must be the name of a table */
    String tableArn();
    Builder tableArn(String tableArn);
    
    /** The number of ImportSummary objects returned in a single page */
    Integer pageSize();
    Builder pageSize(Integer pageSize);
    
    /** An optional string that, if supplied, must be the name of a table */
    String nextToken();
    Builder nextToken(String nextToken);
}

class ListImportsResponse {
    /** A list of ImportSummary objects */
    List<ImportSummary> importSummaryList();
    
    /** If this value is returned, there are additional results to be displayed */
    String nextToken();
}

class ImportSummary {
    /** The Amazon Resource Number (ARN) corresponding to the import request */
    String importArn();
    
    /** The status of the import operation */
    ImportStatus importStatus();
    
    /** The table name of the table created as part of the import operation */
    String tableName();
    
    /** The Amazon Resource Number (ARN) of the table being imported into */
    String tableArn();
    
    /** The S3 bucket that provides the source for the import */
    S3BucketSource s3BucketSource();
    
    /** The format of the source data */
    InputFormat inputFormat();
    
    /** The time when this import task began */
    Instant startTime();
    
    /** The time at which the creation of this import task completed */
    Instant endTime();
}

Usage Example:

// List all imports
ListImportsResponse response = client.listImports(ListImportsRequest.builder()
    .pageSize(20)
    .build());

System.out.println("Found " + response.importSummaryList().size() + " imports:");

for (ImportSummary importSummary : response.importSummaryList()) {
    System.out.println("  Import: " + importSummary.importArn());
    System.out.println("    Status: " + importSummary.importStatus());
    System.out.println("    Table: " + importSummary.tableName());
    System.out.println("    Started: " + importSummary.startTime());
    System.out.println("    S3 Source: s3://" + importSummary.s3BucketSource().s3Bucket() + 
                      "/" + importSummary.s3BucketSource().s3KeyPrefix());
    System.out.println();
}

// Check specific import status
DescribeImportResponse describeResponse = client.describeImport(DescribeImportRequest.builder()
    .importArn("arn:aws:dynamodb:us-east-1:123456789012:table/Products-Imported/import/01234567890123-abcdefab")
    .build());

ImportTableDescription importDetails = describeResponse.importTableDescription();
System.out.println("Import status: " + importDetails.importStatus());
System.out.println("Items imported: " + importDetails.importedItemCount());
System.out.println("Errors: " + importDetails.errorCount());

Export Table to Point in Time

Exports table data to Amazon S3 from a specific point in time.

/**
 * Exports table data to an Amazon S3 bucket
 * @param request - The request containing export configuration
 * @return Response containing export description
 */
ExportTableToPointInTimeResponse exportTableToPointInTime(ExportTableToPointInTimeRequest request);

class ExportTableToPointInTimeRequest {
    static Builder builder();
    
    /** The Amazon Resource Name (ARN) associated with the table to export */
    String tableArn();
    Builder tableArn(String tableArn);
    
    /** Time in the past from which to export table data */
    Instant exportTime();
    Builder exportTime(Instant exportTime);
    
    /** Providing a ClientToken makes the call idempotent */
    String clientToken();
    Builder clientToken(String clientToken);
    
    /** The name of the Amazon S3 bucket to export the snapshot to */
    String s3Bucket();
    Builder s3Bucket(String s3Bucket);
    
    /** The Amazon S3 bucket prefix to use as the file name and path of the exported snapshot */
    String s3Prefix();
    Builder s3Prefix(String s3Prefix);
    
    /** Type of encryption used on the backup */
    S3SseAlgorithm s3SseAlgorithm();
    Builder s3SseAlgorithm(S3SseAlgorithm s3SseAlgorithm);
    
    /** The ID of the AWS KMS managed key used to encrypt the S3 bucket where export data is stored */
    String s3SseKmsKeyId();
    Builder s3SseKmsKeyId(String s3SseKmsKeyId);
    
    /** The format for the exported data */
    ExportFormat exportFormat();
    Builder exportFormat(ExportFormat exportFormat);
    
    /** Option to export the table across multiple S3 files */
    ExportType exportType();
    Builder exportType(ExportType exportType);
    
    /** The maximum number of items to export */
    Long maxItems();
    Builder maxItems(Long maxItems);
}

class ExportTableToPointInTimeResponse {
    /** Contains a description of the table export */
    ExportDescription exportDescription();
}

class ExportDescription {
    /** The Amazon Resource Name (ARN) of the table export */
    String exportArn();
    
    /** Export can be in one of the following states: IN_PROGRESS, COMPLETED, or FAILED */
    ExportStatus exportStatus();
    
    /** The time at which the export task began */
    Instant startTime();
    
    /** The time at which the export task completed */
    Instant endTime();
    
    /** The name of the manifest file for the export task */
    String exportManifest();
    
    /** The Amazon Resource Name (ARN) of the table that was exported */
    String tableArn();
    
    /** Unique ID of the table that was exported */
    String tableId();
    
    /** Point in time from which table data was exported */
    Instant exportTime();
    
    /** The client token that was provided for the export task */
    String clientToken();
    
    /** The name of the Amazon S3 bucket containing the export */
    String s3Bucket();
    
    /** The Amazon S3 bucket prefix used as the file name and path of the exported snapshot */
    String s3Prefix();
    
    /** Type of encryption used on the backup */
    S3SseAlgorithm s3SseAlgorithm();
    
    /** The ID of the AWS KMS managed key used to encrypt the S3 bucket where export data was stored */
    String s3SseKmsKeyId();
    
    /** Status code for the result of the failed export */
    String failureCode();
    
    /** Export failure reason description */
    String failureMessage();
    
    /** The format of the exported data */
    ExportFormat exportFormat();
    
    /** The billable size of the table export */
    Long billedSizeBytes();
    
    /** The number of items exported */
    Long itemCount();
    
    /** The type of export that was performed */
    ExportType exportType();
}

Usage Example:

import java.time.Instant;
import java.time.temporal.ChronoUnit;

// Export table data to S3
Instant exportTime = Instant.now().minus(1, ChronoUnit.HOURS);

ExportTableToPointInTimeResponse response = client.exportTableToPointInTime(
    ExportTableToPointInTimeRequest.builder()
        .tableArn("arn:aws:dynamodb:us-east-1:123456789012:table/Orders")
        .exportTime(exportTime)
        .s3Bucket("my-export-bucket")
        .s3Prefix("exports/orders/2025-09-07/")
        .exportFormat(ExportFormat.DYNAMODB_JSON)
        .exportType(ExportType.FULL_EXPORT)
        .s3SseAlgorithm(S3SseAlgorithm.AES256)
        .clientToken("export-orders-" + System.currentTimeMillis())
        .build()
);

ExportDescription exportDesc = response.exportDescription();
System.out.println("Export started: " + exportDesc.exportArn());
System.out.println("Status: " + exportDesc.exportStatus());
System.out.println("S3 Location: s3://" + exportDesc.s3Bucket() + "/" + exportDesc.s3Prefix());

Describe Export

Retrieves information about a table export operation.

/**
 * Describes an existing export of a table
 * @param request - The request containing export ARN
 * @return Response containing export description
 */
DescribeExportResponse describeExport(DescribeExportRequest request);

class DescribeExportRequest {
    static Builder builder();
    
    /** The Amazon Resource Name (ARN) associated with the export */
    String exportArn();
    Builder exportArn(String exportArn);
}

class DescribeExportResponse {
    /** Represents the properties of the export */
    ExportDescription exportDescription();
}

List Exports

Lists all export tasks for the current account.

/**
 * Lists completed exports within the past 90 days
 * @param request - The request containing filtering options
 * @return Response containing list of exports
 */
ListExportsResponse listExports(ListExportsRequest request);

class ListExportsRequest {
    static Builder builder();
    
    /** The Amazon Resource Name (ARN) associated with the exported table */
    String tableArn();
    Builder tableArn(String tableArn);
    
    /** Maximum number of exports to return */
    Integer maxResults();
    Builder maxResults(Integer maxResults);
    
    /** An optional string that, if supplied, must be the name of a table */
    String nextToken();
    Builder nextToken(String nextToken);
}

class ListExportsResponse {
    /** A list of ExportSummary objects */
    List<ExportSummary> exportSummaries();
    
    /** If this value is returned, there are additional results to be displayed */
    String nextToken();
}

class ExportSummary {
    /** The Amazon Resource Name (ARN) of the export */
    String exportArn();
    
    /** Export can be in one of the following states: IN_PROGRESS, COMPLETED, or FAILED */
    ExportStatus exportStatus();
    
    /** The time at which the export task began */
    Instant startTime();
    
    /** The time at which the export task completed */
    Instant endTime();
    
    /** The type of export that was performed */
    ExportType exportType();
}

Usage Example:

// List all exports for a specific table
ListExportsResponse response = client.listExports(ListExportsRequest.builder()
    .tableArn("arn:aws:dynamodb:us-east-1:123456789012:table/Orders")
    .maxResults(50)
    .build());

System.out.println("Found " + response.exportSummaries().size() + " exports:");

for (ExportSummary exportSummary : response.exportSummaries()) {
    System.out.println("  Export: " + exportSummary.exportArn());
    System.out.println("    Status: " + exportSummary.exportStatus());
    System.out.println("    Type: " + exportSummary.exportType());
    System.out.println("    Started: " + exportSummary.startTime());
    if (exportSummary.endTime() != null) {
        System.out.println("    Completed: " + exportSummary.endTime());
    }
    System.out.println();
}

Data Formats

Supported Import Formats

enum InputFormat {
    DYNAMODB_JSON("DYNAMODB_JSON"),
    ION("ION"),
    CSV("CSV");
}

enum InputFormatOptions {
    // CSV-specific options
    CSV_DELIMITER(","),
    CSV_HEADER_LIST("header1,header2,header3");
}

Supported Export Formats

enum ExportFormat {
    DYNAMODB_JSON("DYNAMODB_JSON"),
    ION("ION");
}

enum ExportType {
    FULL_EXPORT("FULL_EXPORT"),
    INCREMENTAL_EXPORT("INCREMENTAL_EXPORT");
}

S3 Security Options

enum S3SseAlgorithm {
    AES256("AES256"),
    KMS("KMS");
}

Import/Export Best Practices

Data Validation

Always validate imported data and monitor export progress:

// Monitor import progress
public void monitorImportProgress(String importArn) {
    ImportStatus status = ImportStatus.IN_PROGRESS;
    
    while (status == ImportStatus.IN_PROGRESS) {
        try {
            Thread.sleep(30000); // Wait 30 seconds
            
            DescribeImportResponse response = client.describeImport(
                DescribeImportRequest.builder().importArn(importArn).build()
            );
            
            ImportTableDescription desc = response.importTableDescription();
            status = desc.importStatus();
            
            System.out.println("Import status: " + status);
            if (desc.importedItemCount() != null) {
                System.out.println("Items imported: " + desc.importedItemCount());
            }
            if (desc.errorCount() != null && desc.errorCount() > 0) {
                System.out.println("Errors: " + desc.errorCount());
            }
            
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            break;
        }
    }
    
    System.out.println("Final import status: " + status);
}

Cost Optimization

  1. Export Compression: Use efficient export formats
  2. S3 Storage Classes: Use appropriate S3 storage classes for exports
  3. Selective Exports: Export only necessary data ranges
  4. Batch Operations: Group related import/export operations
// Optimize export with specific time range and format
ExportTableToPointInTimeRequest optimizedExport = ExportTableToPointInTimeRequest.builder()
    .tableArn(tableArn)
    .exportTime(specificPointInTime)
    .s3Bucket("my-backup-bucket")
    .s3Prefix("efficient-exports/")
    .exportFormat(ExportFormat.ION)  // More compact format
    .exportType(ExportType.INCREMENTAL_EXPORT)  // Only changes
    .s3SseAlgorithm(S3SseAlgorithm.AES256)  // Cost-effective encryption
    .build();

Security Considerations

  1. Encryption: Always use encryption for sensitive data
  2. Access Control: Implement proper IAM policies for S3 buckets
  3. Network Security: Use VPC endpoints when possible
  4. Data Classification: Tag exports appropriately
// Secure export configuration
.s3SseAlgorithm(S3SseAlgorithm.KMS)
.s3SseKmsKeyId("arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012")
.clientToken("secure-export-" + UUID.randomUUID())

Error Handling

try {
    ImportTableResponse response = client.importTable(request);
    // Monitor import progress
    monitorImportProgress(response.importTableDescription().importArn());
    
} catch (ResourceNotFoundException e) {
    System.err.println("S3 resource not found: " + e.getMessage());
} catch (ValidationException e) {
    System.err.println("Invalid import configuration: " + e.getMessage());
} catch (LimitExceededException e) {
    System.err.println("Import limits exceeded: " + e.getMessage());
} catch (DynamoDbException e) {
    System.err.println("DynamoDB error: " + e.getMessage());
}

Install with Tessl CLI

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

docs

backup-restore.md

data-operations.md

global-tables.md

import-export.md

index.md

partiql.md

table-management.md

transactions.md

tile.json