Creating a DynamoDB table with a Global Secondary Index using the AWS SDK for Java

In the earlier chapters, we have seen how to create a table; now, let's see how to create a DynamoDB table with a Global Secondary Index.

Getting ready

To perform this recipe, you can use the IDE of your choice.

How to do it…

To get started, create a maven project, and add the AWS SDK dependency to the POM.xml file. Here is the latest version of the AWS SDK for Java:

<dependency>
  <groupId>com.amazonaws</groupId>
  <artifactId>aws-java-sdk</artifactId>
  <version>1.9.34</version>
</dependency>

Once done, perform the following steps to create a DynamoDB table with a Global Secondary Index:

  1. Create an instance of the DynamoDB class and initialize it with ProfileCredentialsProvider ...

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.