AWS SDK for Java v2 DynamoDB client library for interacting with Amazon DynamoDB NoSQL database service
Complete table lifecycle management including creation, modification, deletion, and monitoring. This covers all aspects of managing DynamoDB tables from initial setup through ongoing maintenance and optimization.
Creates a new DynamoDB table with specified attributes, key schema, and configuration.
/**
* Creates a new table for your account
* @param request - The request containing table definition and configuration
* @return Response containing table description and creation status
*/
CreateTableResponse createTable(CreateTableRequest request);
class CreateTableRequest {
static Builder builder();
/** An array of attributes that describe the key schema for the table and indexes */
List<AttributeDefinition> attributeDefinitions();
Builder attributeDefinitions(Collection<AttributeDefinition> attributeDefinitions);
/** The name of the table to create */
String tableName();
Builder tableName(String tableName);
/** Specifies the attributes that make up the primary key for a table or an index */
List<KeySchemaElement> keySchema();
Builder keySchema(Collection<KeySchemaElement> keySchema);
/** One or more local secondary indexes (the maximum is 5) to be created on the table */
List<LocalSecondaryIndex> localSecondaryIndexes();
Builder localSecondaryIndexes(Collection<LocalSecondaryIndex> localSecondaryIndexes);
/** One or more global secondary indexes (the maximum is 20) to be created on the table */
List<GlobalSecondaryIndex> globalSecondaryIndexes();
Builder globalSecondaryIndexes(Collection<GlobalSecondaryIndex> globalSecondaryIndexes);
/** Controls how you are charged for read and write throughput */
BillingMode billingMode();
Builder billingMode(BillingMode billingMode);
/** Represents the provisioned throughput settings for a specified table or index */
ProvisionedThroughput provisionedThroughput();
Builder provisionedThroughput(ProvisionedThroughput provisionedThroughput);
/** The settings for DynamoDB Streams on the table */
StreamSpecification streamSpecification();
Builder streamSpecification(StreamSpecification streamSpecification);
/** Represents the settings used to enable server-side encryption */
SSESpecification sseSpecification();
Builder sseSpecification(SSESpecification sseSpecification);
/** A list of key-value pairs to label the table */
List<Tag> tags();
Builder tags(Collection<Tag> tags);
/** The table class of the new table */
TableClass tableClass();
Builder tableClass(TableClass tableClass);
/** Indicates whether deletion protection is to be enabled (true) or disabled (false) on the table */
Boolean deletionProtectionEnabled();
Builder deletionProtectionEnabled(Boolean deletionProtectionEnabled);
/** The resource policy document to attach to the specified table */
String resourcePolicy();
Builder resourcePolicy(String resourcePolicy);
}
class AttributeDefinition {
static Builder builder();
/** A name for the attribute */
String attributeName();
Builder attributeName(String attributeName);
/** The data type for the attribute */
ScalarAttributeType attributeType();
Builder attributeType(ScalarAttributeType attributeType);
}
class KeySchemaElement {
static Builder builder();
/** The name of a key attribute */
String attributeName();
Builder attributeName(String attributeName);
/** The role that this key attribute will assume */
KeyType keyType();
Builder keyType(KeyType keyType);
}
class ProvisionedThroughput {
static Builder builder();
/** The maximum number of strongly consistent reads consumed per second */
Long readCapacityUnits();
Builder readCapacityUnits(Long readCapacityUnits);
/** The maximum number of writes consumed per second */
Long writeCapacityUnits();
Builder writeCapacityUnits(Long writeCapacityUnits);
}
class GlobalSecondaryIndex {
static Builder builder();
/** The name of the global secondary index */
String indexName();
Builder indexName(String indexName);
/** The complete key schema for a global secondary index */
List<KeySchemaElement> keySchema();
Builder keySchema(Collection<KeySchemaElement> keySchema);
/** Represents attributes that are copied (projected) from the table into the index */
Projection projection();
Builder projection(Projection projection);
/** Represents the provisioned throughput settings for the specified global secondary index */
ProvisionedThroughput provisionedThroughput();
Builder provisionedThroughput(ProvisionedThroughput provisionedThroughput);
/** Represents the settings for on-demand scaling */
OnDemandThroughput onDemandThroughput();
Builder onDemandThroughput(OnDemandThroughput onDemandThroughput);
}
class CreateTableResponse {
/** Represents the properties of the table */
TableDescription tableDescription();
}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();
// Create a table with both hash and range key
CreateTableResponse response = client.createTable(CreateTableRequest.builder()
.tableName("Orders")
.attributeDefinitions(List.of(
AttributeDefinition.builder()
.attributeName("customerId")
.attributeType(ScalarAttributeType.S)
.build(),
AttributeDefinition.builder()
.attributeName("orderDate")
.attributeType(ScalarAttributeType.S)
.build(),
AttributeDefinition.builder()
.attributeName("orderId")
.attributeType(ScalarAttributeType.S)
.build()
))
.keySchema(List.of(
KeySchemaElement.builder()
.attributeName("customerId")
.keyType(KeyType.HASH)
.build(),
KeySchemaElement.builder()
.attributeName("orderDate")
.keyType(KeyType.RANGE)
.build()
))
.globalSecondaryIndexes(List.of(
GlobalSecondaryIndex.builder()
.indexName("OrderIdIndex")
.keySchema(List.of(
KeySchemaElement.builder()
.attributeName("orderId")
.keyType(KeyType.HASH)
.build()
))
.projection(Projection.builder()
.projectionType(ProjectionType.ALL)
.build())
.build()
))
.billingMode(BillingMode.PAY_PER_REQUEST) // On-demand billing
.streamSpecification(StreamSpecification.builder()
.streamEnabled(true)
.streamViewType(StreamViewType.NEW_AND_OLD_IMAGES)
.build())
.sseSpecification(SSESpecification.builder()
.enabled(true)
.sseType(SSEType.KMS)
.build())
.deletionProtectionEnabled(true) // Enable deletion protection
.tags(List.of(
Tag.builder().key("Environment").value("Production").build(),
Tag.builder().key("Application").value("OrderSystem").build()
))
.build());
TableDescription table = response.tableDescription();
System.out.println("Table created: " + table.tableName());
System.out.println("Status: " + table.tableStatus());
System.out.println("ARN: " + table.tableArn());Retrieves information about a table including its current status, configuration, and metadata.
/**
* Returns information about the table, including the current status, creation date and time, and table size
* @param request - The request containing table name
* @return Response containing complete table description
*/
DescribeTableResponse describeTable(DescribeTableRequest request);
class DescribeTableRequest {
static Builder builder();
/** The name of the table to describe */
String tableName();
Builder tableName(String tableName);
}
class DescribeTableResponse {
/** Represents the properties of the table */
TableDescription table();
}
class TableDescription {
/** An array of AttributeDefinition objects */
List<AttributeDefinition> attributeDefinitions();
/** The name of the table */
String tableName();
/** The primary key structure for the table */
List<KeySchemaElement> keySchema();
/** The current state of the table */
TableStatus tableStatus();
/** The date and time when the table was created */
Instant creationDateTime();
/** Represents the provisioned throughput settings for the table */
ProvisionedThroughputDescription provisionedThroughput();
/** The total size of the specified table, in bytes */
Long tableSizeBytes();
/** The number of items in the specified table */
Long itemCount();
/** The Amazon Resource Name (ARN) that uniquely identifies the table */
String tableArn();
/** Unique identifier for the table that stays constant across restores */
String tableId();
/** Contains information about the table's Local Secondary Indexes */
List<LocalSecondaryIndexDescription> localSecondaryIndexes();
/** Contains the details for the table's Global Secondary Indexes */
List<GlobalSecondaryIndexDescription> globalSecondaryIndexes();
/** The current DynamoDB Streams configuration for the table */
StreamSpecification streamSpecification();
/** A timestamp when the point-in-time recovery status was last set */
String latestStreamLabel();
/** The Amazon Resource Name (ARN) that uniquely identifies the latest stream for this table */
String latestStreamArn();
/** Represents the version of global tables in use */
String globalTableVersion();
/** Represents replicas of the table */
List<ReplicaDescription> replicas();
/** Contains details for the restore */
RestoreSummary restoreSummary();
/** The description of the server-side encryption status on the specified table */
SSEDescription sseDescription();
/** Represents the properties of the table when the backup was created */
ArchivalSummary archivalSummary();
/** Contains information about the table class */
TableClassSummary tableClassSummary();
/** Indicates whether deletion protection is enabled (true) or disabled (false) on the table */
Boolean deletionProtectionEnabled();
}Usage Example:
// Get detailed table information
DescribeTableResponse response = client.describeTable(DescribeTableRequest.builder()
.tableName("Orders")
.build());
TableDescription table = response.table();
System.out.println("Table: " + table.tableName());
System.out.println("Status: " + table.tableStatus());
System.out.println("Item count: " + table.itemCount());
System.out.println("Table size: " + table.tableSizeBytes() + " bytes");
System.out.println("Created: " + table.creationDateTime());
// Check provisioned throughput
if (table.provisionedThroughput() != null) {
ProvisionedThroughputDescription throughput = table.provisionedThroughput();
System.out.println("Read capacity: " + throughput.readCapacityUnits());
System.out.println("Write capacity: " + throughput.writeCapacityUnits());
}
// List GSIs
if (table.hasGlobalSecondaryIndexes()) {
System.out.println("Global Secondary Indexes:");
for (GlobalSecondaryIndexDescription gsi : table.globalSecondaryIndexes()) {
System.out.println(" - " + gsi.indexName() + " (" + gsi.indexStatus() + ")");
}
}
// Check if streams are enabled
if (table.streamSpecification() != null && table.streamSpecification().streamEnabled()) {
System.out.println("Streams enabled: " + table.streamSpecification().streamViewType());
System.out.println("Stream ARN: " + table.latestStreamArn());
}Modifies the provisioned throughput settings, global secondary indexes, or DynamoDB Streams settings for a table.
/**
* Modifies the provisioned throughput settings, global secondary indexes, or DynamoDB Streams settings for a given table
* @param request - The request containing table modifications
* @return Response containing updated table description
*/
UpdateTableResponse updateTable(UpdateTableRequest request);
class UpdateTableRequest {
static Builder builder();
/** An array of attributes that describe the key schema for the table and indexes */
List<AttributeDefinition> attributeDefinitions();
Builder attributeDefinitions(Collection<AttributeDefinition> attributeDefinitions);
/** The name of the table to be updated */
String tableName();
Builder tableName(String tableName);
/** Controls how you are charged for read and write throughput */
BillingMode billingMode();
Builder billingMode(BillingMode billingMode);
/** The new provisioned throughput settings for the specified table */
ProvisionedThroughput provisionedThroughput();
Builder provisionedThroughput(ProvisionedThroughput provisionedThroughput);
/** An array of one or more global secondary indexes for the table */
List<GlobalSecondaryIndexUpdate> globalSecondaryIndexUpdates();
Builder globalSecondaryIndexUpdates(Collection<GlobalSecondaryIndexUpdate> globalSecondaryIndexUpdates);
/** Represents the DynamoDB Streams configuration for the table */
StreamSpecification streamSpecification();
Builder streamSpecification(StreamSpecification streamSpecification);
/** The new server-side encryption settings for the specified table */
SSESpecification sseSpecification();
Builder sseSpecification(SSESpecification sseSpecification);
/** A list of replica update actions (create, delete, or update) for the table */
List<ReplicationGroupUpdate> replicaUpdates();
Builder replicaUpdates(Collection<ReplicationGroupUpdate> replicaUpdates);
/** The table class of the table to be updated */
TableClass tableClass();
Builder tableClass(TableClass tableClass);
/** Indicates whether deletion protection is to be enabled (true) or disabled (false) on the table */
Boolean deletionProtectionEnabled();
Builder deletionProtectionEnabled(Boolean deletionProtectionEnabled);
/** An Amazon EventBridge event source to assign to the table */
OnDemandThroughput onDemandThroughput();
Builder onDemandThroughput(OnDemandThroughput onDemandThroughput);
}
class GlobalSecondaryIndexUpdate {
static Builder builder();
/** The parameters required for updating a global secondary index */
UpdateGlobalSecondaryIndexAction update();
Builder update(UpdateGlobalSecondaryIndexAction update);
/** The parameters required for creating a global secondary index */
CreateGlobalSecondaryIndexAction create();
Builder create(CreateGlobalSecondaryIndexAction create);
/** The parameters required for deleting a global secondary index */
DeleteGlobalSecondaryIndexAction delete();
Builder delete(DeleteGlobalSecondaryIndexAction delete);
}
class UpdateTableResponse {
/** Represents the properties of the table */
TableDescription tableDescription();
}Usage Example:
// Update table throughput and add a new GSI
UpdateTableResponse response = client.updateTable(UpdateTableRequest.builder()
.tableName("Orders")
.attributeDefinitions(List.of(
AttributeDefinition.builder()
.attributeName("status")
.attributeType(ScalarAttributeType.S)
.build()
))
.globalSecondaryIndexUpdates(List.of(
// Add new GSI
GlobalSecondaryIndexUpdate.builder()
.create(CreateGlobalSecondaryIndexAction.builder()
.indexName("StatusIndex")
.keySchema(List.of(
KeySchemaElement.builder()
.attributeName("status")
.keyType(KeyType.HASH)
.build()
))
.projection(Projection.builder()
.projectionType(ProjectionType.KEYS_ONLY)
.build())
.build())
.build(),
// Update existing GSI throughput
GlobalSecondaryIndexUpdate.builder()
.update(UpdateGlobalSecondaryIndexAction.builder()
.indexName("OrderIdIndex")
.provisionedThroughput(ProvisionedThroughput.builder()
.readCapacityUnits(10L)
.writeCapacityUnits(5L)
.build())
.build())
.build()
))
.streamSpecification(StreamSpecification.builder()
.streamEnabled(true)
.streamViewType(StreamViewType.NEW_AND_OLD_IMAGES)
.build())
.build());
System.out.println("Table update initiated: " + response.tableDescription().tableName());
System.out.println("Status: " + response.tableDescription().tableStatus());Deletes a table and all of its items.
/**
* Deletes a table and all of its items
* @param request - The request containing table name to delete
* @return Response containing final table description
*/
DeleteTableResponse deleteTable(DeleteTableRequest request);
class DeleteTableRequest {
static Builder builder();
/** The name of the table to delete */
String tableName();
Builder tableName(String tableName);
}
class DeleteTableResponse {
/** Represents the properties of the deleted table */
TableDescription tableDescription();
}Usage Example:
// Delete a table (ensure deletion protection is disabled first)
try {
DeleteTableResponse response = client.deleteTable(DeleteTableRequest.builder()
.tableName("TempTable")
.build());
System.out.println("Table deletion initiated: " + response.tableDescription().tableName());
System.out.println("Status: " + response.tableDescription().tableStatus());
} catch (ResourceInUseException e) {
System.err.println("Cannot delete table: " + e.getMessage());
// Table may have deletion protection enabled
} catch (ResourceNotFoundException e) {
System.err.println("Table not found: " + e.getMessage());
}Returns an array of table names associated with the current account and endpoint.
/**
* Returns an array of table names associated with the current account and endpoint
* @param request - The request containing listing options
* @return Response containing table names and pagination info
*/
ListTablesResponse listTables(ListTablesRequest request);
class ListTablesRequest {
static Builder builder();
/** The first table name that this operation will evaluate */
String exclusiveStartTableName();
Builder exclusiveStartTableName(String exclusiveStartTableName);
/** A maximum number of table names to return */
Integer limit();
Builder limit(Integer limit);
}
class ListTablesResponse {
/** The names of the tables associated with the current account at the current endpoint */
List<String> tableNames();
/** The name of the last table in the current page of results */
String lastEvaluatedTableName();
}Usage Example:
// List all tables with pagination
String lastTableName = null;
List<String> allTables = new ArrayList<>();
do {
ListTablesRequest.Builder requestBuilder = ListTablesRequest.builder()
.limit(10); // Limit per page
if (lastTableName != null) {
requestBuilder.exclusiveStartTableName(lastTableName);
}
ListTablesResponse response = client.listTables(requestBuilder.build());
allTables.addAll(response.tableNames());
lastTableName = response.lastEvaluatedTableName();
System.out.println("Found " + response.tableNames().size() + " tables in this page");
} while (lastTableName != null);
System.out.println("Total tables: " + allTables.size());
for (String tableName : allTables) {
System.out.println(" - " + tableName);
}Configure automatic item expiration based on a timestamp attribute.
/**
* Describes the Time to Live (TTL) status on the specified table
* @param request - The request containing table name
* @return Response containing TTL description
*/
DescribeTimeToLiveResponse describeTimeToLive(DescribeTimeToLiveRequest request);
/**
* Enables or disables Time to Live (TTL) for the specified table
* @param request - The request containing TTL specification
* @return Response containing TTL description
*/
UpdateTimeToLiveResponse updateTimeToLive(UpdateTimeToLiveRequest request);
class DescribeTimeToLiveRequest {
static Builder builder();
/** The name of the table to be described */
String tableName();
Builder tableName(String tableName);
}
class UpdateTimeToLiveRequest {
static Builder builder();
/** The name of the table to be configured */
String tableName();
Builder tableName(String tableName);
/** Represents the settings used to enable or disable Time to Live for the specified table */
TimeToLiveSpecification timeToLiveSpecification();
Builder timeToLiveSpecification(TimeToLiveSpecification timeToLiveSpecification);
}
class TimeToLiveSpecification {
static Builder builder();
/** Indicates whether TTL is to be enabled (true) or disabled (false) on the table */
Boolean enabled();
Builder enabled(Boolean enabled);
/** The name of the TTL attribute used to store the expiration time for items in the table */
String attributeName();
Builder attributeName(String attributeName);
}Configure automated backup and point-in-time recovery for tables.
/**
* Checks the status of continuous backups and point in time recovery on the specified table
* @param request - The request containing table name
* @return Response containing backup status
*/
DescribeContinuousBackupsResponse describeContinuousBackups(DescribeContinuousBackupsRequest request);
/**
* Updates the continuous backups and point in time recovery configuration of the specified table
* @param request - The request containing backup configuration
* @return Response containing updated backup description
*/
UpdateContinuousBackupsResponse updateContinuousBackups(UpdateContinuousBackupsRequest request);
class UpdateContinuousBackupsRequest {
static Builder builder();
/** The name of the table */
String tableName();
Builder tableName(String tableName);
/** Represents the settings used to enable point in time recovery */
PointInTimeRecoverySpecification pointInTimeRecoverySpecification();
Builder pointInTimeRecoverySpecification(PointInTimeRecoverySpecification pointInTimeRecoverySpecification);
}Check account-level service limits for DynamoDB.
/**
* Returns the current provisioned-capacity limits for your AWS account in a Region
* @param request - The request for limits information
* @return Response containing current limits
*/
DescribeLimitsResponse describeLimits(DescribeLimitsRequest request);
class DescribeLimitsResponse {
/** The maximum total read capacity units that your account allows you to provision across all of your tables */
Long accountMaxReadCapacityUnits();
/** The maximum total write capacity units that your account allows you to provision across all of your tables */
Long accountMaxWriteCapacityUnits();
/** The maximum read capacity units that your account allows you to provision for a new table */
Long tableMaxReadCapacityUnits();
/** The maximum write capacity units that your account allows you to provision for a new table */
Long tableMaxWriteCapacityUnits();
}Usage Example:
// Check service limits
DescribeLimitsResponse limits = client.describeLimits(DescribeLimitsRequest.builder().build());
System.out.println("Account limits:");
System.out.println(" Max read capacity: " + limits.accountMaxReadCapacityUnits());
System.out.println(" Max write capacity: " + limits.accountMaxWriteCapacityUnits());
System.out.println("Per-table limits:");
System.out.println(" Max read capacity: " + limits.tableMaxReadCapacityUnits());
System.out.println(" Max write capacity: " + limits.tableMaxWriteCapacityUnits());prod-orders, dev-orders)// Good practice: Define all attributes used in key schemas
.attributeDefinitions(List.of(
AttributeDefinition.builder().attributeName("pk").attributeType(ScalarAttributeType.S).build(),
AttributeDefinition.builder().attributeName("sk").attributeType(ScalarAttributeType.S).build(),
AttributeDefinition.builder().attributeName("gsi1pk").attributeType(ScalarAttributeType.S).build()
))// Enable encryption and deletion protection for production tables
.sseSpecification(SSESpecification.builder()
.enabled(true)
.sseType(SSEType.KMS)
.kmsMasterKeyId("alias/my-dynamodb-key")
.build())
.deletionProtectionEnabled(true)
.tags(List.of(
Tag.builder().key("Environment").value("Production").build(),
Tag.builder().key("DataClassification").value("Sensitive").build()
))// Use on-demand billing for unpredictable workloads
.billingMode(BillingMode.PAY_PER_REQUEST)
// Use provisioned billing with auto-scaling for predictable workloads
.billingMode(BillingMode.PROVISIONED)
.provisionedThroughput(ProvisionedThroughput.builder()
.readCapacityUnits(5L)
.writeCapacityUnits(5L)
.build())Manage resource-based access control policies for DynamoDB tables.
/**
* Returns the resource-based policy document attached to the specified DynamoDB resource
* @param request - The request containing resource ARN
* @return Response containing resource policy
*/
GetResourcePolicyResponse getResourcePolicy(GetResourcePolicyRequest request);
class GetResourcePolicyRequest {
static Builder builder();
/** The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy is attached */
String resourceArn();
Builder resourceArn(String resourceArn);
}
class GetResourcePolicyResponse {
/** The resource-based policy document attached to the resource */
String policy();
/** A unique string that represents the revision ID of the policy */
String revisionId();
}
/**
* Attaches a resource-based policy document to a DynamoDB resource
* @param request - The request containing resource ARN and policy document
* @return Response containing revision ID
*/
PutResourcePolicyResponse putResourcePolicy(PutResourcePolicyRequest request);
class PutResourcePolicyRequest {
static Builder builder();
/** The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached */
String resourceArn();
Builder resourceArn(String resourceArn);
/** An Amazon Web Services resource-based policy document in JSON format */
String policy();
Builder policy(String policy);
/** A string value that you can use to conditionally update your policy */
String expectedRevisionId();
Builder expectedRevisionId(String expectedRevisionId);
/** Set this parameter to true to confirm that you want to remove your permissions to change the policy of this resource in the future */
Boolean confirmRemoveSelfResourceAccess();
Builder confirmRemoveSelfResourceAccess(Boolean confirmRemoveSelfResourceAccess);
}
class PutResourcePolicyResponse {
/** A unique string that represents the revision ID of the policy */
String revisionId();
}
/**
* Deletes the resource-based policy attached to the specified DynamoDB resource
* @param request - The request containing resource ARN
* @return Response containing revision ID
*/
DeleteResourcePolicyResponse deleteResourcePolicy(DeleteResourcePolicyRequest request);
class DeleteResourcePolicyRequest {
static Builder builder();
/** The Amazon Resource Name (ARN) of the DynamoDB resource from which the policy will be removed */
String resourceArn();
Builder resourceArn(String resourceArn);
/** A string value that you can use to conditionally delete your policy */
String expectedRevisionId();
Builder expectedRevisionId(String expectedRevisionId);
}
class DeleteResourcePolicyResponse {
/** A unique string that represents the revision ID of the policy */
String revisionId();
}Manage tags for DynamoDB resources for organization and cost allocation.
/**
* List all tags on an Amazon DynamoDB resource
* @param request - The request containing resource ARN
* @return Response containing list of tags
*/
ListTagsOfResourceResponse listTagsOfResource(ListTagsOfResourceRequest request);
class ListTagsOfResourceRequest {
static Builder builder();
/** The Amazon DynamoDB resource with tags to be listed */
String resourceArn();
Builder resourceArn(String resourceArn);
/** An optional string that, if supplied, must be the name of a key */
String nextToken();
Builder nextToken(String nextToken);
}
class ListTagsOfResourceResponse {
/** The tags currently associated with the Amazon DynamoDB resource */
List<Tag> tags();
/** If this value is returned, there are additional results to be displayed */
String nextToken();
}
/**
* Associate a set of tags with an Amazon DynamoDB resource
* @param request - The request containing resource ARN and tags
* @return Response indicating success
*/
TagResourceResponse tagResource(TagResourceRequest request);
class TagResourceRequest {
static Builder builder();
/** Identifies the Amazon DynamoDB resource to which tags should be added */
String resourceArn();
Builder resourceArn(String resourceArn);
/** The tags to be assigned to the Amazon DynamoDB resource */
List<Tag> tags();
Builder tags(Collection<Tag> tags);
}
class TagResourceResponse {
// Empty response indicating success
}
/**
* Removes the association of tags from an Amazon DynamoDB resource
* @param request - The request containing resource ARN and tag keys
* @return Response indicating success
*/
UntagResourceResponse untagResource(UntagResourceRequest request);
class UntagResourceRequest {
static Builder builder();
/** The DynamoDB resource that the tags will be removed from */
String resourceArn();
Builder resourceArn(String resourceArn);
/** A list of tag keys */
List<String> tagKeys();
Builder tagKeys(Collection<String> tagKeys);
}
class UntagResourceResponse {
// Empty response indicating success
}
class Tag {
static Builder builder();
/** The key of the tag */
String key();
Builder key(String key);
/** The value of the tag */
String value();
Builder value(String value);
}Monitor and analyze DynamoDB table performance with Contributor Insights.
/**
* Returns information about contributor insights for a given table or global secondary index
* @param request - The request containing table name and optional index name
* @return Response containing contributor insights description
*/
DescribeContributorInsightsResponse describeContributorInsights(DescribeContributorInsightsRequest request);
class DescribeContributorInsightsRequest {
static Builder builder();
/** The name of the table to describe */
String tableName();
Builder tableName(String tableName);
/** The name of the global secondary index to describe, if applicable */
String indexName();
Builder indexName(String indexName);
}
class DescribeContributorInsightsResponse {
/** The name of the table being described */
String tableName();
/** The name of the global secondary index being described */
String indexName();
/** List of contributor insights rules associated with this table */
List<ContributorInsightsRule> contributorInsightsRuleList();
/** Current status of contributor insights */
ContributorInsightsStatus contributorInsightsStatus();
/** Timestamp of the last time the status was changed */
Instant lastUpdateDateTime();
/** Details about the last failure */
FailureException failureException();
}
/**
* Returns a list of contributor insights summaries for a table and all its global secondary indexes
* @param request - The request containing optional table name filter
* @return Response containing list of contributor insights summaries
*/
ListContributorInsightsResponse listContributorInsights(ListContributorInsightsRequest request);
class ListContributorInsightsRequest {
static Builder builder();
/** The name of the table for which you want to list contributor insights */
String tableName();
Builder tableName(String tableName);
/** A token to for the desired page, if there is one */
String nextToken();
Builder nextToken(String nextToken);
/** Maximum number of results to return per page */
Integer maxResults();
Builder maxResults(Integer maxResults);
}
class ListContributorInsightsResponse {
/** A list of ContributorInsightsSummary objects */
List<ContributorInsightsSummary> contributorInsightsSummaries();
/** A token to go to the next page if there is one */
String nextToken();
}
/**
* Enables or disables contributor insights for a table or global secondary index
* @param request - The request containing table configuration
* @return Response containing updated contributor insights status
*/
UpdateContributorInsightsResponse updateContributorInsights(UpdateContributorInsightsRequest request);
class UpdateContributorInsightsRequest {
static Builder builder();
/** The name of the table */
String tableName();
Builder tableName(String tableName);
/** The global secondary index name, if applicable */
String indexName();
Builder indexName(String indexName);
/** Represents the contributor insights action */
ContributorInsightsAction contributorInsightsAction();
Builder contributorInsightsAction(ContributorInsightsAction contributorInsightsAction);
}
class UpdateContributorInsightsResponse {
/** The name of the table */
String tableName();
/** The name of the global secondary index, if applicable */
String indexName();
/** The status of contributor insights */
ContributorInsightsStatus contributorInsightsStatus();
}Monitor and configure auto scaling for table replicas.
/**
* Describes auto scaling settings across replicas of the specified global table or global secondary index
* @param request - The request containing table name
* @return Response containing replica auto scaling descriptions
*/
DescribeTableReplicaAutoScalingResponse describeTableReplicaAutoScaling(DescribeTableReplicaAutoScalingRequest request);
class DescribeTableReplicaAutoScalingRequest {
static Builder builder();
/** The name of the table */
String tableName();
Builder tableName(String tableName);
}
class DescribeTableReplicaAutoScalingResponse {
/** Represents the auto scaling configuration for the table */
TableAutoScalingDescription tableAutoScalingDescription();
}
class TableAutoScalingDescription {
/** The name of the table */
String tableName();
/** The current state of the table */
TableStatus tableStatus();
/** Represents replicas of the global table */
List<ReplicaAutoScalingDescription> replicas();
}
/**
* Updates auto scaling settings on your global tables at once
* @param request - The request containing auto scaling updates
* @return Response containing updated table auto scaling description
*/
UpdateTableReplicaAutoScalingResponse updateTableReplicaAutoScaling(UpdateTableReplicaAutoScalingRequest request);
class UpdateTableReplicaAutoScalingRequest {
static Builder builder();
/** The name of the global table to be updated */
String tableName();
Builder tableName(String tableName);
/** The new provisioned write capacity settings for the specified table or index */
AutoScalingSettingsUpdate provisionedWriteCapacityAutoScalingUpdate();
Builder provisionedWriteCapacityAutoScalingUpdate(AutoScalingSettingsUpdate provisionedWriteCapacityAutoScalingUpdate);
/** Represents the auto scaling settings of the global secondary indexes of the replica to be updated */
List<GlobalSecondaryIndexAutoScalingUpdate> globalSecondaryIndexUpdates();
Builder globalSecondaryIndexUpdates(Collection<GlobalSecondaryIndexAutoScalingUpdate> globalSecondaryIndexUpdates);
/** Represents the auto scaling settings of replicas of the table that will be modified */
List<ReplicaAutoScalingUpdate> replicaUpdates();
Builder replicaUpdates(Collection<ReplicaAutoScalingUpdate> replicaUpdates);
}
class UpdateTableReplicaAutoScalingResponse {
/** Returns information about the auto scaling configuration of a table */
TableAutoScalingDescription tableAutoScalingDescription();
}Configure Kinesis Data Streams integration for DynamoDB tables.
/**
* Returns information about the status of Kinesis streaming
* @param request - The request containing table name
* @return Response containing Kinesis streaming description
*/
DescribeKinesisStreamingDestinationResponse describeKinesisStreamingDestination(DescribeKinesisStreamingDestinationRequest request);
class DescribeKinesisStreamingDestinationRequest {
static Builder builder();
/** The name of the table being described */
String tableName();
Builder tableName(String tableName);
}
class DescribeKinesisStreamingDestinationResponse {
/** The name of the table being described */
String tableName();
/** The list of replica structures for the table being described */
List<KinesisDataStreamDestination> kinesisDataStreamDestinations();
}
/**
* Starts table data replication to the specified Kinesis data stream at a timestamp chosen during the enable workflow
* @param request - The request containing table name and stream ARN
* @return Response containing streaming destination description
*/
EnableKinesisStreamingDestinationResponse enableKinesisStreamingDestination(EnableKinesisStreamingDestinationRequest request);
class EnableKinesisStreamingDestinationRequest {
static Builder builder();
/** The name of the DynamoDB table */
String tableName();
Builder tableName(String tableName);
/** The ARN for a Kinesis data stream */
String streamArn();
Builder streamArn(String streamArn);
/** The format for the records stream */
DestinationStatus destinationStatus();
Builder destinationStatus(DestinationStatus destinationStatus);
}
class EnableKinesisStreamingDestinationResponse {
/** The name of the table being modified */
String tableName();
/** The ARN for the specific Kinesis data stream */
String streamArn();
/** The current status of replication */
DestinationStatus destinationStatus();
}
/**
* Stops replication from the DynamoDB table to the Kinesis data stream
* @param request - The request containing table name and stream ARN
* @return Response containing streaming destination description
*/
DisableKinesisStreamingDestinationResponse disableKinesisStreamingDestination(DisableKinesisStreamingDestinationRequest request);
class DisableKinesisStreamingDestinationRequest {
static Builder builder();
/** The name of the DynamoDB table */
String tableName();
Builder tableName(String tableName);
/** The ARN for a Kinesis data stream */
String streamArn();
Builder streamArn(String streamArn);
}
class DisableKinesisStreamingDestinationResponse {
/** The name of the table being modified */
String tableName();
/** The ARN for the specific Kinesis data stream */
String streamArn();
/** The current status of replication */
DestinationStatus destinationStatus();
}
/**
* Updates the status for the specified Kinesis streaming destination
* @param request - The request containing table name and stream configuration
* @return Response containing updated streaming destination description
*/
UpdateKinesisStreamingDestinationResponse updateKinesisStreamingDestination(UpdateKinesisStreamingDestinationRequest request);
class UpdateKinesisStreamingDestinationRequest {
static Builder builder();
/** The table name for the Kinesis streaming destination to be updated */
String tableName();
Builder tableName(String tableName);
/** The ARN for the Kinesis stream */
String streamArn();
Builder streamArn(String streamArn);
/** The command to update the Kinesis streaming destination configuration */
UpdateKinesisStreamingConfiguration updateKinesisStreamingConfiguration();
Builder updateKinesisStreamingConfiguration(UpdateKinesisStreamingConfiguration updateKinesisStreamingConfiguration);
}
class UpdateKinesisStreamingDestinationResponse {
/** The table name for the Kinesis streaming destination to be updated */
String tableName();
/** The ARN for the Kinesis stream */
String streamArn();
/** The status of the attempt to update the Kinesis streaming destination */
DestinationStatus destinationStatus();
/** The command to update the Kinesis streaming destination configuration */
UpdateKinesisStreamingConfiguration updateKinesisStreamingConfiguration();
}Retrieve regional endpoint information for DynamoDB service discovery. This operation returns endpoint details that can be used for optimized regional access and endpoint caching.
/**
* Returns the regional endpoint information for DynamoDB service discovery
* @param request - The request for endpoint information (no parameters required)
* @return Response containing list of available endpoints with caching information
*/
DescribeEndpointsResponse describeEndpoints(DescribeEndpointsRequest request);
class DescribeEndpointsRequest {
static Builder builder();
// Empty request - no parameters required for endpoint discovery
}
class DescribeEndpointsResponse {
/** List of available DynamoDB endpoints in the region */
List<Endpoint> endpoints();
}
class Endpoint {
/** IP address or hostname of the endpoint */
String address();
/** Endpoint cache time to live (TTL) value in minutes */
Long cachePeriodInMinutes();
}Usage Example:
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.*;
DynamoDbClient client = DynamoDbClient.builder().build();
// Discover available DynamoDB endpoints
DescribeEndpointsResponse response = client.describeEndpoints(
DescribeEndpointsRequest.builder().build()
);
// Process endpoint information
response.endpoints().forEach(endpoint -> {
System.out.println("Endpoint address: " + endpoint.address());
System.out.println("Cache period: " + endpoint.cachePeriodInMinutes() + " minutes");
});
// Use first endpoint for optimized regional access
if (!response.endpoints().isEmpty()) {
Endpoint firstEndpoint = response.endpoints().get(0);
// Configure client with discovered endpoint if needed
}enum ContributorInsightsStatus {
ENABLING("ENABLING"),
ENABLED("ENABLED"),
DISABLING("DISABLING"),
DISABLED("DISABLED"),
FAILED("FAILED");
}
enum ContributorInsightsAction {
ENABLE("ENABLE"),
DISABLE("DISABLE");
}
enum DestinationStatus {
ENABLING("ENABLING"),
ACTIVE("ACTIVE"),
DISABLING("DISABLING"),
DISABLED("DISABLED"),
ENABLE_FAILED("ENABLE_FAILED"),
DISABLE_FAILED("DISABLE_FAILED");
}
enum GlobalTableStatus {
CREATING("CREATING"),
ACTIVE("ACTIVE"),
DELETING("DELETING"),
UPDATING("UPDATING");
}
enum BillingMode {
PROVISIONED("PROVISIONED"),
PAY_PER_REQUEST("PAY_PER_REQUEST");
}
enum ScalarAttributeType {
S("S"), // String
N("N"), // Number
B("B"); // Binary
}
enum KeyType {
HASH("HASH"),
RANGE("RANGE");
}
enum ProjectionType {
ALL("ALL"),
KEYS_ONLY("KEYS_ONLY"),
INCLUDE("INCLUDE");
}
enum IndexStatus {
CREATING("CREATING"),
UPDATING("UPDATING"),
DELETING("DELETING"),
ACTIVE("ACTIVE");
}
enum SSEType {
AES256("AES256"),
KMS("KMS");
}
enum TableClass {
STANDARD("STANDARD"),
STANDARD_INFREQUENT_ACCESS("STANDARD_INFREQUENT_ACCESS");
}Install with Tessl CLI
npx tessl i tessl/maven-software-amazon-awssdk--dynamodb