Search code examples
amazon-web-servicesamazon-s3aws-sdkamazon-sqs

S3 Notifications invoke sqs topic in other region


I have a bucket which I have configured SQS in US-EAST-1 and S3 Bucket in US West Carlifornia region , Is there any way that I can configure the SQS from other region to be invoked at the time of an s3 event

Able to setup event notification when

S3 - Same region - Same account SQS - Same region - Same account

S3 - Same Region - Different account SQS - Same Region - in another account

NOT WORKING

S3 - Different region SQS - Different region

can someone help me, please?


Solution

  • The Amazon SQS queue must be in the same region as your Amazon S3 bucket.

    https://docs.aws.amazon.com/AmazonS3/latest/user-guide/setup-event-notification-destination.html

    It isn't a supported configuration for S3 to reach across a regional boundary to send a notification to SQS. The reason why is not specifically stated in the documentation.

    But there is a workaround.

    An S3 bucket in us-west-1 can send an event notification to an SNS topic in us-west-1, and and an SQS queue in us-east-1 can subscribe to an SNS topic in us-west-1... so S3 (us-west-1) → SNS (us-west-1) → SQS (us-east-1) is the solution, here. After subscribing the queue to the topic, you may want to enable the "raw message delivery" option on the subscription, otherwise the message format will differ from what you expect, because otherwise SNS will add an outer wrapper to the original event notification payload.