我需要查询DynamoDB .
目前我做了这个代码:
AWSCredentials creds = new DefaultAWSCredentialsProviderChain().getCredentials();
AmazonDynamoDBClient client = new AmazonDynamoDBClient(creds);
client.withRegion(Regions.US_WEST_2);
DynamoDB dynamoDB = new DynamoDB(new AmazonDynamoDBClient(creds));
Table table = dynamoDB.getTable("dev");
QuerySpec spec = new QuerySpec().withKeyConditionExpression("tableKey = :none.json");
ItemCollection<QueryOutcome> items = table.query(spec);
System.out.println(table);
table
的返回值为: {dev: null}
,表示该描述为空 .
使用AWS CLI使用此命令's important to say that while i' m: aws dynamodb list-tables
i 'm getting a result of all the tables so if i' m对我的代码进行相同的操作 dynamoDB.listTables()
正在检索空列表 .
有什么东西我做错了吗?在使用DDB API之前是否需要定义更多凭据?