Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access denied to SQS via AWS SDK

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.*" 

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

Access to the resource https://sqs.us-west-2.amazonaws.com/ is denied.

EDIT: added the full error message

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 ?

like image 339
SupaCoco Avatar asked Nov 27 '13 16:11

SupaCoco


People also ask

How do I access SQS in AWS?

Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/ . In the navigation pane, choose Users. Choose the name of the user whose access keys you want to create, and then choose the Security credentials tab. In the Access keys section, choose Create access key.

Can API gateway connect to SQS?

The x-amazon-apigateway-integration extension allows you to configure the integration of an AWS service, in our case SQS, directly inside the API Gateway Body element. As you will see if you look at the documentation to this extension linked above, there are myriad attributes available for this.

How do I give Lambda access to SQS?

In order to grant a Lambda function access to an SQS queue, we have to attach an IAM policy to the function's execution role. The policy should grant permissions for all the Actions the function needs to perform on the queue.


1 Answers

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

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.

like image 130
SupaCoco Avatar answered Oct 06 '22 23:10

SupaCoco