question

Will Strain avatar image
Will Strain asked

Lambda and open sessions

I was wondering if anyone knew about how lambda handles open sessions. Like if I open the session and then have multiple intents in the one session and I only billed for the time the intents are actually running or do I get billed for the time that it is just waiting for the user too? It looks like lambda is only running when a intent is sent and only Alexa skills cares about the session stuff but I just want to check before I write a bunch of code that I can't use because it will cost a lot to run. Thanks
alexa skills kit
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Greg Crawford avatar image
Greg Crawford answered
The time spent waiting for user input is on the Echo, not in your intent handler, so your lambda function is not billed for usage when waiting for user input.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Will Strain avatar image
Will Strain answered
I thought so, I mean it would only make sense. Thank you
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered
One thing to note is that Lambda shuts down the whole JVM between calls. That threw me at first. All your global variables, caches, and everything else, poof, gone. If you want to persist information, you need to do so in the session structure they supply, or in some other back end store.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.