Amazon DynamoDB InvalidSignatureException


De este código estoy recibiendo el error a continuación

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'));

Recibo el siguiente error al intentar agregar una tabla a DynamoDB de AWS.

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

Hasta ahora he:

  • Comprobado para ver si la Clave de Autenticación y la Clave Secreta eran correctas, lo eran.
  • rIZO actualizado
  • Cuando puse permisos de autenticación falsos, el error no cambió.
Author: Glenn Dayton, 2013-08-18

4 answers

Parece que la hora local del sistema puede ser incorrecta. He tenido un problema similar con AWS S3, donde mi reloj del sistema estaba sesgado por 30 minutos.

Si está ejecutando ubuntu, intente actualizar la hora del sistema:

sudo ntpdate ntp.ubuntu.com
 86
Author: andreimarinescu,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-08-18 15:25:49

También puede reiniciar su servicio de fecha para resolver el problema si ya tiene instalado ntpdate.

sudo service ntpdate stop
sudo service ntpdate start
 2
Author: arete,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-30 15:48:11

Si está utilizando docker-machine en Mac, puede resolver con este comando:

docker-machine ssh default 'sudo ntpclient -s -h pool.ntp.org'

 1
Author: Allan Sene,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-04-26 18:46:01

Nota rápida para proyectos vagabundos: esto se resuelve normalmente por vagrant reload.

 1
Author: Scott Rigby,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-07-23 17:42:27