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?

gefragt vor 4 Jahren3539 Aufrufe
1 Antwort
1
Akzeptierte Antwort

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
beantwortet vor 4 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen