AWS SDK for Java v2 DynamoDB client library for interacting with Amazon DynamoDB NoSQL database service
Multi-region replication support for globally distributed applications. Global Tables provide fully managed, serverless, multi-region, and multi-active database replication for DynamoDB tables.
Creates a global table from an existing DynamoDB table.
/**
* Creates a global table from an existing table
* @param request - The request containing global table configuration
* @return Response containing global table description
*/
CreateGlobalTableResponse createGlobalTable(CreateGlobalTableRequest request);
class CreateGlobalTableRequest {
static Builder builder();
/** The global table name */
String globalTableName();
Builder globalTableName(String globalTableName);
/** The Regions where the global table needs to be created */
List<Replica> replicationGroup();
Builder replicationGroup(Collection<Replica> replicationGroup);
}
class Replica {
static Builder builder();
/** The Region of the replica to be added or deleted */
String regionName();
Builder regionName(String regionName);
}
class CreateGlobalTableResponse {
/** Contains the details of the global table */
GlobalTableDescription globalTableDescription();
}Retrieves information about a global table.
/**
* Returns information about the specified global table
* @param request - The request containing global table name
* @return Response containing global table description
*/
DescribeGlobalTableResponse describeGlobalTable(DescribeGlobalTableRequest request);
class DescribeGlobalTableRequest {
static Builder builder();
/** The name of the global table */
String globalTableName();
Builder globalTableName(String globalTableName);
}
class DescribeGlobalTableResponse {
/** Contains the details of the global table */
GlobalTableDescription globalTableDescription();
}
class GlobalTableDescription {
/** The global table name */
String globalTableName();
/** The unique identifier of the global table */
String globalTableArn();
/** The creation time of the global table */
Instant creationDateTime();
/** The current state of the global table */
GlobalTableStatus globalTableStatus();
/** The Regions where the global table has replicas */
List<ReplicaDescription> replicationGroup();
}Adds or removes replicas in a global table.
/**
* Adds or removes replicas in the specified global table
* @param request - The request containing replica updates
* @return Response containing updated global table description
*/
UpdateGlobalTableResponse updateGlobalTable(UpdateGlobalTableRequest request);
class UpdateGlobalTableRequest {
static Builder builder();
/** The global table name */
String globalTableName();
Builder globalTableName(String globalTableName);
/** A list of Regions that should be added or removed from the global table */
List<ReplicaUpdate> replicaUpdates();
Builder replicaUpdates(Collection<ReplicaUpdate> replicaUpdates);
}
class ReplicaUpdate {
static Builder builder();
/** The parameters required for creating a replica on a global table */
CreateReplicaAction create();
Builder create(CreateReplicaAction create);
/** The name of the existing replica to be removed from the global table */
DeleteReplicaAction delete();
Builder delete(DeleteReplicaAction delete);
}Lists all global tables for the current account.
/**
* Lists all global tables that have a replica in the specified Region
* @param request - The request containing listing options
* @return Response containing global table names
*/
ListGlobalTablesResponse listGlobalTables(ListGlobalTablesRequest request);
class ListGlobalTablesRequest {
static Builder builder();
/** The first global table name that this operation will evaluate */
String exclusiveStartGlobalTableName();
Builder exclusiveStartGlobalTableName(String exclusiveStartGlobalTableName);
/** The maximum number of table names to return */
Integer limit();
Builder limit(Integer limit);
/** Lists the global tables in a specific Region */
String regionName();
Builder regionName(String regionName);
}
class ListGlobalTablesResponse {
/** List of global table names */
List<GlobalTable> globalTables();
/** The name of the last global table in the current page of results */
String lastEvaluatedGlobalTableName();
}Usage Examples:
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.*;
import java.util.List;
DynamoDbClient client = DynamoDbClient.builder().build();
// Create global table with replicas in multiple regions
CreateGlobalTableResponse response = client.createGlobalTable(
CreateGlobalTableRequest.builder()
.globalTableName("Orders")
.replicationGroup(List.of(
Replica.builder().regionName("us-east-1").build(),
Replica.builder().regionName("eu-west-1").build(),
Replica.builder().regionName("ap-northeast-1").build()
))
.build()
);
System.out.println("Global table created: " + response.globalTableDescription().globalTableName());
// Add new replica to existing global table
UpdateGlobalTableResponse updateResponse = client.updateGlobalTable(
UpdateGlobalTableRequest.builder()
.globalTableName("Orders")
.replicaUpdates(List.of(
ReplicaUpdate.builder()
.create(CreateReplicaAction.builder()
.regionName("us-west-2")
.build())
.build()
))
.build()
);
// List all global tables
ListGlobalTablesResponse listResponse = client.listGlobalTables(
ListGlobalTablesRequest.builder().build()
);
for (GlobalTable globalTable : listResponse.globalTables()) {
System.out.println("Global table: " + globalTable.globalTableName());
}Retrieves detailed Region-specific settings for a global table, including billing mode, capacity settings, and auto-scaling configuration for each replica.
/**
* Describes Region-specific settings for a global table
* @param request - The request containing global table name
* @return Response containing detailed global table settings for all replicas
*/
DescribeGlobalTableSettingsResponse describeGlobalTableSettings(DescribeGlobalTableSettingsRequest request);
class DescribeGlobalTableSettingsRequest {
static Builder builder();
/** The name of the global table to describe */
String globalTableName();
Builder globalTableName(String globalTableName);
}
class DescribeGlobalTableSettingsResponse {
/** The name of the global table */
String globalTableName();
/** The Region-specific settings for each replica of the global table */
List<ReplicaSettingsDescription> replicaSettings();
}
class ReplicaSettingsDescription {
/** The Region name of the replica */
String regionName();
/** The current state of the replica (CREATING, UPDATING, DELETING, ACTIVE) */
ReplicaStatus replicaStatus();
/** The read/write capacity mode of the replica */
BillingModeSummary replicaBillingModeSummary();
/** The maximum number of strongly consistent reads consumed per second */
Long replicaProvisionedReadCapacityUnits();
/** Auto scaling settings for replica's read capacity units */
AutoScalingSettingsDescription replicaProvisionedReadCapacityAutoScalingSettings();
/** The maximum number of writes consumed per second */
Long replicaProvisionedWriteCapacityUnits();
/** Auto scaling settings for replica's write capacity units */
AutoScalingSettingsDescription replicaProvisionedWriteCapacityAutoScalingSettings();
/** Global secondary index settings for this replica */
List<ReplicaGlobalSecondaryIndexSettingsDescription> replicaGlobalSecondaryIndexSettings();
/** Table class for this replica */
TableClass replicaTableClass();
}Usage Example:
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.*;
DynamoDbClient client = DynamoDbClient.builder().build();
// Describe global table settings
DescribeGlobalTableSettingsResponse response = client.describeGlobalTableSettings(
DescribeGlobalTableSettingsRequest.builder()
.globalTableName("my-global-table")
.build()
);
System.out.println("Global Table: " + response.globalTableName());
// Examine settings for each replica
response.replicaSettings().forEach(replica -> {
System.out.println("Region: " + replica.regionName());
System.out.println("Status: " + replica.replicaStatus());
if (replica.replicaBillingModeSummary() != null) {
System.out.println("Billing Mode: " + replica.replicaBillingModeSummary().billingMode());
}
if (replica.replicaProvisionedReadCapacityUnits() != null) {
System.out.println("Read Capacity: " + replica.replicaProvisionedReadCapacityUnits());
}
if (replica.replicaProvisionedWriteCapacityUnits() != null) {
System.out.println("Write Capacity: " + replica.replicaProvisionedWriteCapacityUnits());
}
System.out.println("---");
});Updates settings for a global table and all its replicas, including billing mode, capacity settings, auto-scaling configuration, and replica-specific settings.
/**
* Updates settings for a global table and its replicas
* @param request - The request containing global table settings updates
* @return Response containing updated global table settings
*/
UpdateGlobalTableSettingsResponse updateGlobalTableSettings(UpdateGlobalTableSettingsRequest request);
class UpdateGlobalTableSettingsRequest {
static Builder builder();
/** The name of the global table to update */
String globalTableName();
Builder globalTableName(String globalTableName);
/** The billing mode of the global table (PROVISIONED or PAY_PER_REQUEST) */
BillingMode globalTableBillingMode();
Builder globalTableBillingMode(BillingMode globalTableBillingMode);
/** The maximum number of writes consumed per second before DynamoDB returns a ThrottlingException */
Long globalTableProvisionedWriteCapacityUnits();
Builder globalTableProvisionedWriteCapacityUnits(Long globalTableProvisionedWriteCapacityUnits);
/** Auto scaling settings for managing provisioned write capacity for the global table */
AutoScalingSettingsUpdate globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate();
Builder globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate(AutoScalingSettingsUpdate globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate);
/** Settings for global secondary indexes that will be modified */
List<GlobalTableGlobalSecondaryIndexSettingsUpdate> globalTableGlobalSecondaryIndexSettingsUpdate();
Builder globalTableGlobalSecondaryIndexSettingsUpdate(Collection<GlobalTableGlobalSecondaryIndexSettingsUpdate> globalTableGlobalSecondaryIndexSettingsUpdate);
/** Settings for each replica region that will be modified */
List<ReplicaSettingsUpdate> replicaSettingsUpdate();
Builder replicaSettingsUpdate(Collection<ReplicaSettingsUpdate> replicaSettingsUpdate);
}
class UpdateGlobalTableSettingsResponse {
/** The name of the global table */
String globalTableName();
/** The updated Region-specific settings for each replica */
List<ReplicaSettingsDescription> replicaSettings();
}Usage Example:
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.*;
import java.util.Arrays;
DynamoDbClient client = DynamoDbClient.builder().build();
// Update global table to pay-per-request billing
UpdateGlobalTableSettingsResponse response = client.updateGlobalTableSettings(
UpdateGlobalTableSettingsRequest.builder()
.globalTableName("my-global-table")
.globalTableBillingMode(BillingMode.PAY_PER_REQUEST)
.build()
);
// Update specific replica settings
UpdateGlobalTableSettingsResponse replicaResponse = client.updateGlobalTableSettings(
UpdateGlobalTableSettingsRequest.builder()
.globalTableName("my-global-table")
.replicaSettingsUpdate(
ReplicaSettingsUpdate.builder()
.regionName("us-west-2")
.replicaProvisionedReadCapacityUnits(1000L)
.replicaProvisionedWriteCapacityUnits(1000L)
.build()
)
.build()
);
// Update with auto-scaling settings
UpdateGlobalTableSettingsResponse autoScalingResponse = client.updateGlobalTableSettings(
UpdateGlobalTableSettingsRequest.builder()
.globalTableName("my-global-table")
.globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate(
AutoScalingSettingsUpdate.builder()
.minimumUnits(5L)
.maximumUnits(1000L)
.autoScalingDisabled(false)
.targetTrackingScalingPolicyConfiguration(
TargetTrackingScalingPolicyConfiguration.builder()
.targetValue(70.0)
.build()
)
.build()
)
.build()
);
System.out.println("Updated Global Table: " + response.globalTableName());
response.replicaSettings().forEach(replica -> {
System.out.println("Replica " + replica.regionName() + " status: " + replica.replicaStatus());
});Creates a new table by importing data from 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 ImportTableResponse {
/** Represents the properties of the table created for the import operation */
ImportTableDescription importTableDescription();
}Exports table data to 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);
}
class ExportTableToPointInTimeResponse {
/** Contains a description of the table export */
ExportDescription exportDescription();
}Usage Examples:
import java.time.Instant;
import java.time.temporal.ChronoUnit;
// Export table data to S3
Instant exportTime = Instant.now().minus(1, ChronoUnit.HOURS);
ExportTableToPointInTimeResponse exportResponse = 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)
.s3SseAlgorithm(S3SseAlgorithm.AES256)
.clientToken("export-orders-" + System.currentTimeMillis())
.build()
);
System.out.println("Export started: " + exportResponse.exportDescription().exportArn());Install with Tessl CLI
npx tessl i tessl/maven-software-amazon-awssdk--dynamodb