Having difficulties setting up Amazon AWS SQS queues

Posted 3 years ago by georgeinggs

I've decided to host the production version of my app with AWS, so I've setup a test EC2 instance with a copy of my app and am now trying to move my queues from Beanstalkd to SQS. I had the queues working just fine locally, but cannot for the life of me get my test SQS queue to accept any jobs. I've tried every combination of configuration I can find with no luck. I think the issue is a security issue, rather than a setup issue - since I can't seem to get past the authorisation stage at this point.

So here's a portion of my .env file:

AWS_ACCESS_KEY_ID=***mykeyidhere***
AWS_SECRET_ACCESS_KEY=***mykeyhere***

QUEUE_EMAIL_URL=https://sqs.ap-southeast-2.amazonaws.com/***myaccountnumber***/queue-email
QUEUE_EMAIL_REGION=ap-southeast-2

Here's the relevant part of my queue.php config:

'default' => 'queue-email',

'connections' => [

      'queue-email' => [
            'driver' => 'sqs',
            'key'    => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'queue'  => env('QUEUE_EMAIL_URL'),
            'region' => env('QUEUE_EMAIL_REGION')
        ],

    ],

For some reason, I'm getting this error:

SqsException in WrappedHttpHandler.php line 159:
Error executing "SendMessage" on "https://sqs.ap-southeast-2.amazonaws.com/queue-email"; AWS HTTP error: Client error: `POST https://sqs.ap-southeast-2.amazonaws.com/queue-email` resulted in a `404 Not Found` response:
<?xml version="1.0"?><ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Type>Sender</Type><Code>I (truncated...)
InvalidAddress (client): The address /queue-email is not valid for this endpoint. - <?xml version="1.0"?><ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Type>Sender</Type><Code>InvalidAddress</Code><Message>The address /queue-email is not valid for this endpoint.</Message><Detail/></Error><RequestId>1a2915f5-265a-5e55-9942-5aea94ea1497</RequestId></ErrorResponse>

I feel like for some reason that the SDK isn't parsing the config properly, since the 404 error above is pointing to https://sqs.ap-southeast-2.amazonaws.com/queue-email when it should be pointing to https://sqs.ap-southeast-2.amazonaws.com/myaccountnumber/queue-email

As far as permissions on the SQS queue go, I've got the following access policy defined for the queue:

Effect      Principals      Actions                     Conditions
Allow       Everybody (*)   All SQS Actions (SQS:*)     None

Also, based on some posts I found, I have created a .aws directory in my root folder and saved a credentials file there with the following contents:

[default]
aws_access_key_id = ***mykeyidhere***
aws_secret_access_key = ***mykeyhere***

I'm just going in circles at the moment and could really do with some help to get things up and running. It's a little demoralizing going from working fine on my local dev environment to being completely broken again in "production"!

Thanks :)

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.