Document interfaces - Amazon DynamoDB

Document interfaces

Many AWS SDKs provide a document interface, allowing you to perform data plane operations (create, read, update, delete) on tables and indexes. With a document interface, you do not need to specify Data type descriptors. The data types are implied by the semantics of the data itself. These AWS SDKs also provide methods to easily convert JSON documents to and from native Amazon DynamoDB data types.


Document interfaces are available in the AWS SDKs for Java, .NET, Node.js, and JavaScript in the browser.

The following Java program uses the document interface of the AWS SDK for Java. The program creates a Table object that represents the Music table, and then asks that object to use GetItem to retrieve a song. The program then prints the year that the song was released.

The class implements the DynamoDB document interface. Note how DynamoDB acts as a wrapper around the low-level client (AmazonDynamoDB).

package com.amazonaws.codesamples.gsg; import; import; import; import; import; public class MusicDocumentDemo { public static void main(String[] args) { AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard().build(); DynamoDB docClient = new DynamoDB(client); Table table = docClient.getTable("Music"); GetItemOutcome outcome = table.getItemOutcome( "Artist", "No One You Know", "SongTitle", "Call Me Today"); int year = outcome.getItem().getInt("Year"); System.out.println("The song was released in " + year); } }