aws lambda使用_使用AWS Lambda处理大型S3文件

aws lambda使用

Despite having a runtime limit of 15 minutes, AWS Lambda can still be used to process large files. Files formats such as CSV or newline delimited JSON which can be read iteratively or line by line can be processed with this method.

尽管运行时限制为15分钟,但AWS Lambda仍可用于处理大文件。 可以迭代或逐行读取的文件格式(例如CSV或换行符分隔的JSON)可以使用此方法进行处理。

Lambda is a good option if you want a serverless architecture and have files that are large but still within reasonable limits. We’ll show how we can write a lambda function that can process a large csv file in the following manner. The function will be capable of handling data sizes exceeding both its memory and runtime limits.

如果您需要无服务器架构并且文件很大但仍在合理范围内,则Lambda是一个不错的选择。 我们将展示如何编写可以以以下方式处理大型csv文件的lambda函数。 该功能将能够处理超出其内存和运行时限制的数据大小。

The main approach is as follows:

主要方法如下:

  1. Read and process the csv file row by row until nearing timeout.

    逐行读取并处理csv文件,直到接近超时。
  2. Trigger a new lambda asynchronously that will pick up from where the previous lambda stopped processing.

    异步触发一个新的lambda,它将从先前的lambda停止处理的地方开始提取。

We will define the following event which will be used to trigger the lambda function. The use of bucket_name and object_key is necessary to identify the S3 object that will be processed, the use of the offset and fieldnames wi

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值