如何在Lambda函数上挂载EFS? [英] How to mount EFS on a Lambda function?

查看:214
本文介绍了如何在Lambda函数上挂载EFS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的EFS驱动器上运行定期清理(该清理被多个自动缩放的EC2实例共享).清理涉及删除符合特定条件(日期/大小等)的文件/文件夹.

I need to run a periodic cleanup on my EFS drive (which is being shared by multiple autoscaling EC2 instances). The cleanup involves deleting files/folders that meet a certain criterion (date/size etc.).

我认为AWS Lambda是完成此任务的理想解决方案.只需定期触发该功能,即可挂载共享驱动器并运行清理.但是,看来Lambda仅支持为其类型创建/轮询磁盘以及修改其挂载点等.

I imagined AWS Lambda to be the perfect solution for this task. Just trigger the function periodically, which should mount the Shared drive and run the cleanup. But it seems that Lambda only supports Creating/polling the disk for it's type and modifying its mountpoint etc.

是否有其他选择可以完成此任务?

Is there any alternative to accomplish this task?

推荐答案

到目前为止,我发现Lambda不支持直接文件操作,但它可以启动EC2实例,该实例可以运行启动脚本来执行以下操作:进行清理,然后关闭. 尽管此解决方案比较笨拙,但我看不到任何替代方案.

So far I've found that while direct file operations aren't supported by Lambda, it can spin up an EC2 instance, which can run a startup script to do the cleanup and then shutdown. While this solution is rather clunky, I do not see any alternative.

Lambda对EFS的支持似乎是一个长期的需求:

Lambda support for EFS seems to be a long standing demand:

为什么您不能将EFS挂载到Lambda吗?

可以从Lambda中挂载EFS吗?环境

这篇关于如何在Lambda函数上挂载EFS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆