Workaround for Lambda 15 minute timeout

0

Customer is trying to use a Lambda function to handle resizing of EC2 instances across the organization. The script will stop the instance, resize it, and then start the instance. However some EC2 instances take longer than 15 minutes to stop and Lambda ends up timing out. I understand the 15 minute timeout is a hard limit but are there any workaround or retry methods the customer could leverage?

已提问 4 年前3539 查看次数
1 回答
1
已接受的回答

Customer should decouple the process into 2 or more steps. One lambda that stops the instance and puts a message in a Queue (SQS). By using the invisibility feature (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-timers.html) the customer can control the other function to trigger only at every 5 mins interval. That other function basically checks if the instance is stopped then does what ever it needs. If the instance is not stopped, it puts the message back in the queue.

AWS
sebper
已回答 4 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则