简体   繁体   English

AWS Lambda跨区域输出处理

[英]AWS Lambda cross-region output processing

I have a lambda function deployed in 3 AWS regions. 我在3个AWS区域部署了lambda函数。 I want to invoke these functions which will write a output file in S3 within those region buckets. 我想调用这些函数,这些函数将在S3中的区域桶中写入输出文件。

Then I want to collect these files (from 3 region buckets) to do further processing on them. 然后我想收集这些文件(来自3个区域桶)以对它们进行进一步处理。

What would be the best way to do that using AWS service. 使用AWS服务的最佳方法是什么

I have explored below : 我在下面进行了探讨:

[1] use SNS to trigger the cross-region lambda jobs. [1]使用SNS触发跨区域lambda作业。 But not sure how to get all the 3 output files from the region buckets to do further processing. 但不确定如何从区域桶中获取所有3个输出文件以进行进一步处理。

[2] use AWS Simple Workflow but again you will have to create it in 3 regions and cross-region activity is not supported. [2]使用AWS Simple Workflow,但您必须再次在3个区域中创建它,并且不支持跨区域活动。

You're going to want to setup an event on your S3 bucket to kick off a Lambda whenever an item is written to it. 您将要在S3存储桶上设置一个事件,以便在项目写入​​时启动Lambda。 From: 从:

http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html

For your use-case, the lower-scale and simpler option is to trigger on a putObject to a S3 bucket, it publishes an event to SNS which will directly initiate a Lambda via a CloudWatch Event. 对于您的用例,较低规模和较简单的选项是将putObject触发到S3存储桶,它向SNS发布事件,该事件将通过CloudWatch事件直接启动Lambda。

For larger scale, you'll want to publish your event to an SQS queue which you can now do directly seen here . 对于更大的规模,您需要将事件发布到SQS队列,现在可以在此处直接看到

Also of-note: From your question I don't think you know that lambdas can read/write to ANY region of S3. 另外值得注意的是:从你的问题我不认为你知道lambda可以读/写S3的任何区域。 They do not need to be IN that region. 他们不需要在那个地区。 But they will read/write faster to assets in that region, and won't incur bandwidth fees 但是他们会更快地读/写该地区的资产,并且不会产生带宽费用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM