Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon DynamoDB InvalidSignatureException

From this code I'm getting the error below

require "vendor/autoload.php"; use Aws\Common\Aws; use Aws\DynamoDb\DynamoDbClient; use Aws\DynamoDb\Enum\ComparisonOperator; use Aws\DynamoDb\Enum\KeyType; use Aws\DynamoDb\Enum\Type;  $aws = Aws::factory(array( 'key'    => '[clipped]', 'secret' => '[clipped]', 'region' => Region::US_WEST_1 ));  $client = $aws->get("dynamodb"); $tableName = "ExampleTable";  $result = $client->createTable(array(     "TableName" => $tableName,     "AttributeDefinitions" => array(         array(            "AttributeName" => "Id",            "AttributeType" => Type::NUMBER         )      ),      "KeySchema" => array(         array(            "AttributeName" => "Id",            "KeyType" => KeyType::HASH         )     ),     "ProvisionedThroughput" => array(         "ReadCapacityUnits"    => 5,         "WriteCapacityUnits" => 6     ) ));  print_r($result->getPath('TableDescription')); 

I'm getting the following error when trying to add a table into AWS's DynamoDB.

PHP Fatal error:  Uncaught Aws\\DynamoDb\\Exception\\DynamoDbException: AWS Error Code: InvalidSignatureException,  Status Code: 400,  AWS Request ID: [clipped],  AWS Error Type: client,  AWS Error Message: Signature expired: 20130818T021159Z is now earlier than   20130818T021432Z (20130818T022932Z - 15 min.),  User-Agent: aws-sdk-php2/2.4.3 Guzzle/3.7.2 curl/7.21.6 PHP/5.3.6-13ubuntu3.9\n  thrown in /var/www/vendor/aws/aws-sdk-php/src/Aws/Common/Exception/NamespaceExceptionFactory.php on line 91 

So far I've:

  • Checked to see if Authentication Key and Secret Key were correct, they were.
  • Updated cURL
  • When I put false authentication permissions in, the error didn't change.
like image 621
Glenn Dayton Avatar asked Aug 18 '13 02:08

Glenn Dayton


1 Answers

It seems that your local system time might be incorrect. I've had a similar problem with AWS S3, where my system clock was skewed by 30 mins.

If you're running ubuntu, try updating your system time:

sudo ntpdate ntp.ubuntu.com 
like image 112
andreimarinescu Avatar answered Sep 22 '22 07:09

andreimarinescu