2
votes

We are evaluating Amazon SQS for one of our applications. We will be persisting some messages in SQS for a maximum of 10 hours a day (one of our 'consumers' can only process between 7am and 9pm).

It appears that persisted messages are distributed across multiple availability zones in the same geographical region. Is there a way to achieve replication across regions in SQS? I read Amazon's white paper on DR and it has no mention about SQS.

3

3 Answers

3
votes

What you can do is each time you write into SQS in your region, you also write into SQS in another region. Here are my suggestions:

  1. You would have to do that programmatically, and depending on your requirements you may have to implement a two phase commit.
  2. Alternatively, you use SNS to publish your messages, but configure the SNS subscriptions to write to SQS queues across regions.

Bear in mind that AWS availability zones are already actually geographically distributed, about 50 miles away from each other, I believe.

If this was my project, I would follow option 2. Take a look at this AWS document: http://docs.aws.amazon.com/sns/latest/dg/SendMessageToSQS.html

Basically, what you do is instead of publishing directly to SQS, you create an SNS topic in each region. Each of those topics has SQS subscriptions in both regions as well.

When a message is published to SNS in either region, SNS will automatically publish to both SQS subscriptions.

2
votes

Each SQS queue is currently limited to a single region. Each SQS queue is replicated across multiple Availability Zones though.

0
votes

SQS is replicated redundantly across multiple AZ's.

The only evidence I could find for this is: https://aws.amazon.com/sqs/faqs/#Security_and_reliability

redundant Availability Zones (AZs), so that no single computer, network, or AZ failure can make messages inaccessible

the key part being "redundant AZs". I had felt "make messages" to be ambiguous (do they mean any or all messages?) but the rest of the sentence resolves this.

Concerning cross-region bridging, SQS does not allow this:

Q: Can I share messages between queues in different regions?

No. Each Amazon SQS message queue is independent within each region.

https://aws.amazon.com/sqs/faqs/#Service_access_and_regions

However, Amazon MQ does permit cross region message propagation:

https://docs.aws.amazon.com/amazon-mq/latest/developer-guide/network-of-brokers.html