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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南

相關內容