Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How long can I have my AWS lamba function hold before returning for alexa(amazon echo)?

This is only for a demo and Alexa (Amazon echo) doesn't support us pushing text to it to be spoken randomly so we want to pull off a hack.

  1. User speaks into Alexa
  2. We have our lambda execute an action and then hopefully sleep and wait on an API response which will not happen until we do something
  3. Then we may post a response from another user
  4. Lambda now returns the text

In this way, we are trying to simulate two way communication through Alexa.

Do I have to worry about Alexa timing out? If so, how long will it take? Will my Lambda timeout as well (I am assuming I can just sleep in that code or hang on a remote call)?

like image 706
Dean Hiller Avatar asked Apr 02 '16 02:04

Dean Hiller


People also ask

Does AWS Lambda have a time limit?

Q: How long can an AWS Lambda function execute? AWS Lambda functions can be configured to run up to 15 minutes per execution. You can set the timeout to any value between 1 second and 15 minutes.

What is the default timeout for an AWS Lambda function?

Timeout is the maximum amount of time in seconds that a Lambda function can run. The default value for this setting is 3 seconds, but you can adjust this in increments of 1 second up to a maximum value of 15 minutes. You can configure the timeout of your function in the Lambda console.

How long does Lambda execution environment last?

Duration: The entire Shutdown phase is capped at 2 seconds. If the runtime or any extension does not respond, Lambda terminates it via a signal ( SIGKILL ).


1 Answers

The response timeout is set by your AWS Lambda backend. If you do not configure it from the default, the timeout is 3 seconds by default. The rules for configuring the timeout are documented in the Lambda FAQs:

Q: How long can an AWS Lambda function execute?

All calls made to AWS Lambda must complete execution within 300 seconds. The default timeout is 3 seconds, but you can set the timeout to any value between 1 and 300 seconds.

If your response processing takes long enough to create a noticeable wait, the Echo device will flash its light ring in a rapid circle to indicate work taking place. This will continue, blocking any other interaction with the Echo device, until the response is returned or the backing Lambda function reaches its timeout limit.

like image 75
Sam Hanley Avatar answered Oct 26 '22 02:10

Sam Hanley