Putting items into the DynamoDB table using the object persistence model in Java

Now, we are going to see how to put items into the table using the object persistence model.

Getting ready

Before we start this recipe, the object model needs to be created in the previous recipe.

How to do it…

Let's see how to put items into the table using the object persistence model:

  1. Create an instance of the DynamoDB client class, and initiate it with the credential's profile. You can also set the region if you have created the table in a specific region:
    AmazonDynamoDBClient client = new AmazonDynamoDBClient(
        new ProfileCredentialsProvider());
      client.setRegion(Region.getRegion(Regions.US_EAST_1));
  2. Create an instance of the DynamoDBMapper class, and initiate it with ...

Get DynamoDB Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.