0
votes

Reading the Java AWS API docs and a few tutorials I see that the AWS Java API for DynamoDB has a createTable method. In my case the table is already created and I'm looking to just add a GSI. Is there an way to do that?

Just to add, when I checked if I could call the same createTable again, thinking the new GSI might just get added but i'm getting a response of:

"errorCode": "ResourceInUseException",
"errorMessage": "Table already exists: DeploymentOverview-V1"

Update Just found: http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/dynamodbv2/document/Table.html#createGSI-com.amazonaws.services.dynamodbv2.model.CreateGlobalSecondaryIndexAction-com.amazonaws.services.dynamodbv2.model.AttributeDefinition-com.amazonaws.services.dynamodbv2.model.AttributeDefinition-

1

1 Answers

-1
votes

Click it through AWS console. It is easy.

Otherwise, use CreateTableRequest, as in the official documentation

CreateTableRequest createTableRequest = new CreateTableRequest()
    .withTableName("WeatherData")
    ...
    .withGlobalSecondaryIndexes(precipIndex);