java 如何将 aws lambda 函数的执行时间增加超过 5 分钟?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43361146/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can i increase the execution time of aws lambda function more than 5 min ?
提问by Abhishek gajjar
I have lambda function that take more than 5 min to run.How can i increase the execution time of lambda function more than 5 min so my program can keep going?
我的 lambda 函数需要超过 5 分钟才能运行。如何将 lambda 函数的执行时间增加 5 分钟以上,以便我的程序可以继续运行?
END RequestId: 5b676871-1eef-1xex-bxxa-47xxxxad8d63 The last line show this in cloudwatch. It automatically end the request.Please help. thank you
END RequestId: 5b676871-1eef-1xex-bxxa-47xxxxad8d63 最后一行在 cloudwatch 中显示。它会自动结束请求。请帮忙。谢谢
回答by Udo Held
You cannot increase the runtime to more than 15 minutes.
您不能将运行时间增加到超过 15 分钟。
The AWS Lambda limit
pagestates the Function timeout
is 900 seconds (15 minutes)
. If you need more than 15 minutes of execution time you have to look at other services. You could have a look if AWS Batchwould suit your needs.
在AWS LAMBDAlimit
页指出的Function timeout
是900 seconds (15 minutes)
。如果您需要超过 15 分钟的执行时间,则必须查看其他服务。您可以看看AWS Batch是否满足您的需求。
Updated:The limit was recently changed from 5 minutes to 15 minutes.
更新:该限制最近从 5 分钟更改为 15 分钟。
回答by ExploringApple
Now you can run AWS Lambda up to 15 minutes!
现在您可以运行 AWS Lambda 长达 15 分钟!
回答by muyong
Of course you can. My solution is: 1. Track time elapse in your lambda function 2. When it about to exceeds the limit, send a notification to SNS topic, then exit. 3. Set the SNS topic as trigger to your lambda function. Keep in mind lambda's original purpose is to run short task so it's better to keep your lambda function run within 15 mins.
当然可以。我的解决方案是: 1. 跟踪您的 lambda 函数中的时间流逝 2. 当它即将超过限制时,向 SNS 主题发送通知,然后退出。3. 将 SNS 主题设置为 lambda 函数的触发器。请记住 lambda 的最初目的是运行短期任务,因此最好将 lambda 函数运行在 15 分钟内。
回答by Sai prateek
You can set Timeout
properties of AWS lambda function up to maximum 15 minute.
您最多可以将Timeout
AWS lambda 函数的属性设置为 15 分钟。
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html
回答by John Dough
You cannot. If you need longer time then you need to spin-up an EC2 server instead.
你不能。如果您需要更长的时间,那么您需要启动 EC2 服务器。