【发布时间】:2022-01-16 13:59:08
【问题描述】:
我需要创建一个具有四个属性的 DynamoDB 表。我正在使用以下 Java 程序:
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());
我总是收到以下错误:
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)
如何解决这个错误?
【问题讨论】:
-
听起来您可能没有适当的权限来创建表
-
我有,我正在使用本地主机 AmazonDynamoDB 客户端 = AmazonDynamoDBClientBuilder.standard() .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("localhost:8000", "ap-southeast-2")) .build( );
-
String tableName = "devtest"; Table table = dynamoDB.createTable(tableName, Arrays.asList(new KeySchemaElement("BIC", KeyType.HASH)), // 排序键 Arrays.asList(new AttributeDefinition("BIC", ScalarAttributeType.S)) new ProvisionedThroughput(10L , 10L)); table.waitForActive();如果我使用上面的代码,则表正在成功创建
-
谁能帮我解决这个问题
标签: java amazon-web-services amazon-ec2 aws-lambda amazon-dynamodb