I am trying to use amazon dynamodb in my php application. I have setup the credential correctly. Now, I am trying to get the data from the Amazon DynamoDB to my application. But it is giving me an exception at the query line.
The full exception error is
Unable to query: Error executing "Query" on "https://dynamodb.my-region.amazonaws.com"; AWS HTTP error: Client error:
POST https://dynamodb.my-region.amazonaws.com
resulted in a400 Bad Request
response: {"__type":"com.amazon.coral.validate#ValidationException","message":"Either the KeyConditions or KeyConditionExpression (truncated...) ValidationException (client): Either the KeyConditions or KeyConditionExpression parameter must be specified in the request. - {"__type":"com.amazon.coral.validate#ValidationException","message":"Either the KeyConditions or KeyConditionExpression parameter must be specified in the request."}
Here is my code,
$sdk = new Aws\Sdk([
'region' => 'my region',
'version' => 'latest',
'credentials' => [
'key' => 'my key',
'secret' => 'my secret key'
],
'DynamoDb' => [
'region' => 'my region',
],
]);
$dynamodb = $sdk->createDynamoDb();
$marshaler = new Marshaler();
$tableName = 'My Table Name';
$params = [
'TableName' => $tableName
];
try {
$result = $dynamodb->query($params);
} catch (DynamoDbException $e) {
echo "Unable to query:\n";
echo $e->getMessage() . "\n";
}
The error is coming from the try-catch block. Can anybody give me the reason and solution of this error? Any suggestion for this error? Thanks in advance.