简体   繁体   English

AWS-Lambda Scheduler调用多个Lambda实例

[英]AWS - Lambda Scheduler to invoke multiple lambda instances

I need to poll a DB every 5 minutes , get the list of ids from the db and make service call to external services for each an every id to get additional information and store the data in db. 我需要每5分钟轮询一个数据库,从数据库中获取ID的列表,并为每个ID的外部服务进行服务调用,以获取更多信息并将数据存储在db中。 I thought of building a lambda scheduler that would fetch the list of ids from db and invoke 1 lambda instance for each and every id fetched from db. 我想到了构建一个lambda调度程序,该调度程序将从db中获取ID列表,并为从db中获取的每个id调用1个lambda实例。 The lambda instance which is invoked by the scheduler will call the external service for the specific id that it has received from the scheduler and it will persist the info in a db. 调度程序调用的lambda实例将针对从调度程序收到的特定ID调用外部服务,并将该信息保留在db中。 Is this a feasible pattern for the problem or are there any other patterns available for implementing this use case in aws? 这是解决问题的可行模式吗,还是有其他可用模式可用于在AWS中实施此用例?

My design would be to use a cloudwatch event rule that fires the first lambda function every 5 minutes to gather the list of ids. 我的设计是使用cloudwatch事件规则,该规则每5分钟触发第一个lambda函数以收集ID列表。

That lambda function would the send a message for each id that needs to be processed to an SNS topic, and then I would subscribe the second lambda function to that SNS topic so it would receive the id/message and do the required work. 该lambda函数将为需要处理的每个id发送一条消息给SNS主题,然后我将第二个lambda函数订阅该SNS主题,以便它接收id /消息并完成所需的工作。

https://docs.aws.amazon.com/sns/latest/dg/sns-lambda.html https://docs.aws.amazon.com/sns/latest/dg/sns-lambda.html

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

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