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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠