David
David

Reputation: 53

AWS Java SDK SQSlistener endpoint issues

I am using the AWS Java SDK as well as the spring cloud aws to utilize SES and SQS in my project. I am running into a small issue. When I try running my app I get the error:

Error creating bean with name 'simpleMessageListenerContainer' defined in class path resource [org/springframework/cloud/aws/messaging/config/annotation/SqsConfiguration.class]: Invocation of init method failed; nested exception is com.amazonaws.services.sqs.model.AmazonSQSException: Credential should be scoped to a valid region, not 'queue'.

As a preface, in my app.properties file, I have a property queue.endpoint=https://queue.amazonaws.com/1234567890/queue-name.fifo and the endpoint is retrieved from the aws cli.

I've read the AWS documentation and found out that this endpoint is a legacy endpoint. This property is used by the @SqsListener annotation from spring cloud aws library.

I managed to avoid this issue by seeing if I was using a legacy endpoint and converted it into the non-legacy endpoint through a shell script, ie https://sqs.us-east-1.amazonaws.com/123456780/queue-name.fifo.

I was wondering if the spring cloud aws library had issues with using legacy endpoints. I noticed there were no issues for my other queues where the endpoints were https://us-east-2.queue.amazonaws.com/1234567890/queue2-name.fifo however, so maybe it parsed the us-east-1 legacy endpoint incorrectly? I am also unsure if there were any configurations that needed to be done in my application to utilize the legacy endpoints.

Upvotes: 3

Views: 2305

Answers (1)

Keet Sugathadasa
Keet Sugathadasa

Reputation: 13502

If I understand the question correctly, your question is about SQS Queue endpoint not having the us-east-1 appended at the beginning of the endpoint. It is not a legacy endpoint. In AWS, there are certain services that does not allow you to specify a region in the endpoint. Whatever that is being routed to this endpoint: https://queue.amazonaws.com/1234567890/queue-name.fifo, will be automatically routed to us-east-1 region in AWS.

This is clearly mentioned in the documentation in AWS related to Endpoints. (Link)

Some services, such as IAM, do not support regions; therefore, their endpoints do not include a region. Some services, such as Amazon EC2, let you specify an endpoint that does not include a specific region, for example, https://ec2.amazonaws.com. In that case, AWS routes the endpoint to us-east-1.

Upvotes: 2

Related Questions