Darshan Ambhaikar
Darshan Ambhaikar

Reputation: 785

How to trigger cross region Lambda function using S3 event notification when S3 and Lambda are in different regions

Scenario:

  1. We have a S3 bucket in Region 1 (e.g. Oregon)
  2. We have a Lambda function in Region 2 (e.g. Frankfurt)
  3. We have configured S3 to send event notification whenever object is added to the bucket

Problem:

We need to invoke the Lambda which is in Region 2 using the S3 event notification which is generated in Region 1. We are aware that cross account S3 event configuration with Lambda is allowed. But how to implement cross Region event and lambda invocation!

What we are thinking:

We thought of using SNS in between S3 and Lambda, but not sure if there is any other alternative available or is this the only way. Any help is appreciated.

Upvotes: 1

Views: 3438

Answers (1)

fedonev
fedonev

Reputation: 25779

As you say, the most straightforward approach is use SNS in the middle:

  1. Region1 S3 notification has a Region1 SNS Topic Destination
  2. Region2 Lambda has a cross-region subscription to the Region1 SNS Topic

S3 cannot send notifications directly cross-region.

You could also have S3 replicate the created items to Region2, at which point Region2 S3 can directly notify the Region2 Lambda, which may work if the items are small and latency not a big problem.

Upvotes: 2

Related Questions