1

我在尝试连接到 AWS SQS 时遇到了一个非常特殊的问题。运行此 PHP 代码时:

$client = SqsClient::factory(array(
    'credentials' => [
       'key' => 'somekey',
       'secret' => 'somesecret'
    ],
    'region'  => 'eu-west-1',
    'version' => 'latest'
));
$result = $client->receiveMessage(array(
    'QueueUrl' => $queueUrl,
));

我收到此错误:

PHP Fatal error:  Uncaught exception 'Aws\Sqs\Exception\SqsException' with message 'Error executing "ReceiveMess
age" on "https://sqs.eu-west-1.amazonaws.com/189729872213/my-very-special-queue"; AWS HTTP error: Client error: 403 Inva
lidClientTokenId (client): This account is suspended - <?xml version="1.0"?><ErrorResponse xmlns="http://queue.a
mazonaws.com/doc/2012-11-05/"><Error><Type>Sender</Type><Code>InvalidClientTokenId</Code><Message>This account i
s suspended</Message><Detail/></Error><RequestId>aaf63243-6840-5b49-893a-7d66919c07da</RequestId></ErrorResponse
>'

但是,当我在同一台机器上使用具有相同凭证的 boto(Python 等效的 AWS PHP SDK)时,它可以正常工作!并且帐户按预期打开,我可以访问与其关联的所有队列。

如何使 PHP 代码工作?我应该检查什么?

4

0 回答 0