Amazon SQS不断返回403错误

时间:2017-10-04 12:42:36

标签: php laravel amazon-web-services amazon-s3 amazon-sqs

我在Laravel做项目。为了存储图像,我使用的是aws-s3。我的项目在godaddy服务器上工作得很好,但在数字海洋服务器上却没有。我收到错误,

Aws\Sqs\Exception\SqsException: Error executing "ReceiveMessage" on "https://sqs.us-east-1.amazonaws.com/your-account-id/your-queue-name"; AWS HTTP error: Client error: `POST https://sqs.us-east-1.amazonaws.com/your-account-id/your-queue-name` resulted in a `403 Forbidden` response:
<?xml version="1.0"?><ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Type>Sender</Type><Code>I (truncated...)
 InvalidClientTokenId (client): The security token included in the request is invalid. - <?xml version="1.0"?><Err......

这是我在项目中用于s3设置的代码,

filesystem.php

        's3' => [
        'driver' => 's3',
        'key'    => '************',
        'secret' => '***********',
        'region' => 'ap-south-1',
        'bucket' => 'xyz',
        'options' => [
            'ServerSideEncryption' => 'AES256',
        ]
    ]

.ENV

QUEUE_DRIVER=redis

无论是否遇到任何api,我都会收到此错误。我不知道自己哪里出错了。提前谢谢。

1 个答案:

答案 0 :(得分:1)

问题记录在aws blog,

https://aws.amazon.com/premiumsupport/knowledge-center/security-token-expired/

请检查您的凭据以及适当的角色/策略附加角色以访问S3。