简体   繁体   English

每次触发 Lambda function 时从文件发送行 [python]

[英]Send line from file each time Lambda function is triggered [python]

I have search about this issue and couldn't find anything that would help me.我搜索了这个问题,但找不到任何对我有帮助的东西。

EDITED已编辑

The main idea is to, each time the lambda function is triggered by cloudwatch (everyday), choose a subsequent line from the text file that I get from a s3 bucket, that line will be attached to an e-mail.主要思想是,每次 lambda function 由 cloudwatch(每天)触发时,从我从 s3 存储桶获取的文本文件中选择后续行,该行将附加到电子邮件中。 The next time the lambda is triggered, the same will happen, but with the next line in the text file, and so on.下次触发 lambda 时,同样会发生,但文本文件中的下一行,依此类推。

I have more or less an idea, using a for loop, my problem is how to, each time the function is triggered, select the next line in the text file.我或多或少有一个想法,使用 for 循环,我的问题是每次触发 function 时,文本文件中的下一行 select。

If you need to read lines from your file in sequence, one lambda execution a day is one line, then you have to keep track of those lines .如果您需要按顺序从您的文件中读取行,每天执行一次 lambda 就是一行,那么您必须跟踪这些行 If its only once a day, you could use SSM Parameter Store for that.如果它每天只有一次,您可以为此使用 SSM Parameter Store。 Each time your lambda executes, it would query SSM Parameter Store the the line number which was read previously.每次执行 lambda 时,它都会查询 SSM Parameter Store 之前读取的行号。

Similarly, after successful dispatch of a line, the Lambda function would update the parameter in SSM Parameter Store.同样,线路调度成功后,Lambda function 将更新 SSM Parameter Store 中的参数。

The exact details depend on how big the file is, as this process can get progressively slow with time.确切的细节取决于文件有多大,因为这个过程会随着时间的推移而逐渐变慢。

暂无
暂无

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

相关问题 如果 AWS Lambda function 在指定时间段(假设 2 小时)内未运行(或未被触发),是否可以发送警报? - Is there a way to send an alert if an AWS Lambda function is not running(or not being triggered) for a specified period of time (let's say 2 hours)? 当 Lambda function 触发无法处理该消息时,如何防止 AWS SQS 删除该消息? - How to prevent AWS SQS from deleting a message when Lambda function triggered fails to process that message? 无法在 Lambda 中创建 AWS 胶水爬虫,Lambda 由步骤 function 触发 - Cannot create AWS glue crawler in a Lambda, Lambda is triggered by a Step function 从 AWS lambda function 中的 s3 存储桶中读取 .mdb 或 .accdb 文件并使用 python 将其转换为 excel 或 csv - Reading .mdb or .accdb file from s3 bucket in AWS lambda function and converting it into excel or csv using python 从 AWS 返回 excel 文件 Lambda function - Return excel file from AWS Lambda function Python Lambda 未找到此类文件或目录运行时问题 - Python Lambda no such file or directory found run time issue 将时间值从 jquery 发送到 python 服务器 - send a time value from jquery to a python server 返回音频文件作为来自 AWS 的响应 Lambda function - Returning an audio file as response from AWS Lambda function 如何从 AWS 中的表单数据读取文件 Lambda function - how to read a file from form-Data in an AWS Lambda function 双邮件发送 lambda function - Double emails send by lambda function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM