通过AWS开发工具包拒绝访问SQS [英] Access denied to SQS via AWS SDK

查看:472
本文介绍了通过AWS开发工具包拒绝访问SQS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用Symfony2开发的网站上,我需要在Amazon SQS中发送消息.为此,我将其添加到了composer.json:

I'm currently working on a website developed with Symfony2 and I need to send messages in an Amazon SQS. In order to do that I added to my composer.json:

"aws/aws-sdk-php": "2.4.*"

然后,当我尝试创建队列或列出队列时,出现403错误:

Then when I try to create a queue or list queues I've got a 403 error saying:

访问资源 https://sqs.us-west-2.amazonaws.com/被拒绝.

添加了完整的错误消息

added the full error message

AWS错误代码:AccessDenied,状态代码:403,AWS请求ID: 2fe34c11-7af8-5445-a768-070159a0953e,AWS错误类型:客户端,AWS 错误消息:对资源的访问 https://sqs.us-west-2.amazonaws.com/被拒绝.,用户代理: aws-sdk-php2/2.4.11枪口/3.7.4 curl/7.25.0 PHP/5.4.3

AWS Error Code: AccessDenied, Status Code: 403, AWS Request ID: 2fe34c11-7af8-5445-a768-070159a0953e, AWS Error Type: client, AWS Error Message: Access to the resource https://sqs.us-west-2.amazonaws.com/ is denied., User-Agent: aws-sdk-php2/2.4.11 Guzzle/3.7.4 curl/7.25.0 PHP/5.4.3

这是我的工作的示例代码:

Here is a sample code of what I do:

$aws = Aws::factory(array(
  'key'    => 'my-key',
  'secret' => 'my-secret',
  'region' => 'us-west-2'
));

$sqs = $aws->get('sqs');

return new Response(var_dump($sqs->listQueues()));

要得到此错误,我该怎么做?

What do I do wrong to get this error ?

推荐答案

在挖掘之后,我发现我所使用的帐户未被授予访问SQS服务的权限.

After digging I discovered that the account I was using wasn't granted the access to SQS service.

要授予对帐户的SQS访问权限,您必须转到Amazon管理控制台.然后单击IAM.在此部分下,单击用户",然后您可以管理所创建的每个帐户的权限.

To give a SQS access to an account you have to go to the amazon management console. Then click on IAM. Under this section click on Users and then you can manage permission for each account you created.

这篇关于通过AWS开发工具包拒绝访问SQS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆