大家好我拥有一个表名为test
的Amazon DynamoDB。我有一个像这样的grails控制器:
def ec2Test = {
def tableName = new DescribeTableRequest()
tableName.setTableName("test")
def createdTable = amazonWebService.dynamoDB.describeTable(tableName)
}
但是当我尝试击中这个控制器时,我得到了:
Requested resource not found: Table: Anto_Testing_Table not found
即使我在浏览器中可以看到aws dynamo DB中有一个表名test
..在我的grails config.groovy
中我也添加了以下几行:
grails.plugin.awssdk.accessKey = "xxxxxxx"
grails.plugin.awssdk.secretKey = "xxxxxxx"
grails.plugin.awssdk.region = "ap-southeast-1"
我犯了错误?而且我也尝试创建表格,并打印结果,它看起来像这样:
{TableName: Testing table, KeySchema: {HashKeyElement: {AttributeName: name, AttributeType: S, }, }, TableStatus: CREATING, CreationDateTime: Mon Oct 01 12:23:37 IST 2012, ProvisionedThroughput: {ReadCapacityUnits: 10, WriteCapacityUnits: 10, }, }
我等了大约15分钟。并刷新浏览器,我无法看到表没有创建!我用来创建表的代码是:
String tableName = "Testing Table";
CreateTableRequest createTableRequest = new CreateTableRequest().withTableName(tableName)
.withKeySchema(new KeySchema(new KeySchemaElement().withAttributeName("name").withAttributeType("S")))
.withProvisionedThroughput(new ProvisionedThroughput().withReadCapacityUnits(10L).withWriteCapacityUnits(10L));
TableDescription createdTableDescription = amazonWebService.dynamoDB.createTable(createTableRequest).getTableDescription();
println createdTableDescription
提前致谢。