1

I have a requirement to create a DynamoDB table with four Attribute. I am using the following Java program:

String tableName = "devtest";

Table table = dynamoDB.createTable(tableName,
                    Arrays.asList(new KeySchemaElement("BIC", KeyType.HASH)), // Sort key
                    Arrays.asList(new AttributeDefinition("BIC", ScalarAttributeType.S),
                        new AttributeDefinition("Tenant", ScalarAttributeType.S),
                        new AttributeDefinition("TenantID", ScalarAttributeType.S),
                        new AttributeDefinition("Destination", ScalarAttributeType.S)),
                    new ProvisionedThroughput(10L, 10L));
table.waitForActive();
System.out.println("Success.  Table status: " + table.getDescription().getTableStatus());  
        

I am always getting the following error:

Unable to create table: 
Unable to unmarshall exception response with the unmarshallers provided (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: bc0565ac-9d44-4876-934a-b39fbe8ca3f1)

How to fix this error?

4
  • 1
    It sounds like you may not have the appropriate permissions to create the table Commented Dec 13, 2021 at 0:37
  • 1
    I have, I am using local host AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard() .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("localhost:8000", "ap-southeast-2")) .build(); Commented Dec 13, 2021 at 0:39
  • 1
    String tableName = "devtest"; Table table = dynamoDB.createTable(tableName, Arrays.asList(new KeySchemaElement("BIC", KeyType.HASH)), // Sort key Arrays.asList(new AttributeDefinition("BIC", ScalarAttributeType.S)) new ProvisionedThroughput(10L, 10L)); table.waitForActive(); If I am using above code that tabls is getting successful created Commented Dec 13, 2021 at 0:40
  • 1
    Can any one help me on this Commented Dec 13, 2021 at 2:44

1 Answer 1

4

You can have only one attribute BIC, because this is your HASH. Since you don't have any sort key, local or global secondary indices, you can't define any other attributes.

DynamoDB is schema-less, which means that it does not have any per-define structure.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.