I've a LAMP server on AWS EC2 and I've installed AWS SDK for PHP 2 using Composer, just like instructed here.
I'm trying to run a sample query to insert some items on DynamoDB, but I get the following error on PHP:
PHP Fatal error: Call to undefined method Guzzle\Http\Message\Request::batchWriteItem()
My code:
require "vendor/autoload.php";
use Aws\DynamoDb\DynamoDbClient;
use Aws\Common\Enum\Region;
// Instantiate the DynamoDB client with your AWS credentials
$aws = DynamoDbClient::factory(array(
'key' => 'xxx',
'secret' => 'xxx',
'region' => Region::US_WEST_2
));
$client = $aws->get("dynamodb");
$tableName = "xxxx";
$response = $client->batchWriteItem(array(
"RequestItems" => array(
$tableName => array(
array(
"PutRequest" => array(
"Item" => array(
"IP" => array(Type::STRING => "203.203.203.22"),
"APIKEY" => array(Type::STRING => "jkhkjhskjhs"),
"TIMESTAMP" => array(Type::STRING => time()),
"PostedBy" => array(Type::STRING => "User B")
)
)
)
),
)
));
Ideas???
Thanks!