[英]Trigger Lambda function when a new object arrives in S3 bucket
I have S3 bucket named 'files'. 我有一个名为“文件”的S3存储桶。 Every day new file arrives there. 每天都有新文件到达。 Example: 例:
/files/data-01-23-2017--11-33am.txt
/files/data-01-24-2017--10-28am.txt
How would I make a Lambda function and set a trigger to execute one shell script on EC2 when new file arrives? 当新文件到达时,我将如何执行Lambda函数并设置触发器以在EC2上执行一个Shell脚本? Example of new file is: 新文件的示例是:
/files/data-01-25-2017--11-43am.txt
Command that I would want to execute on EC2 is (with parameter as new file name that just arrived): 我想在EC2上执行的命令是(使用参数作为刚到达的新文件名):
python /home/ec2-user/jobs/run_job.py data-01-25-2017--11-43am.txt
Amazon S3 can be configured to trigger an AWS Lambda function when a new object is created. 可以将Amazon S3配置为在创建新对象时触发AWS Lambda函数。 However, Lambda functions do not have access to your Amazon EC2 instances. 但是,Lambda函数无法访问您的Amazon EC2实例。 It is not an appropriate architecture to use. 它不是适合使用的体系结构。
Some alternative options (these are separate options, not multiple steps): 一些替代选项 (这些是单独的选项,而不是多个步骤):
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.