Amazon DynamoDB
Developer Guide (API Version 2012-08-10)

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 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 (AmazonDynamoDBClient).

package com.amazonaws.codesamples.gsg;


public class MusicDocumentDemo {

    public static void main(String[] args) {

        AmazonDynamoDBClient client = new AmazonDynamoDBClient();
        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);