question

Mike avatar image
Mike asked

RestFULL callout from Lambda function

I'm creating a skill that makes an external call using a Restfull API. When using the skill, either in test or asking Alexa to do it, it takes anywhere from 3-4 seconds from when I call req.end() to entering the response callback. But when I use a rest client to test the API connection it takes less than 200ms. Is there anything I can do to speed up the connection in the Lambda function?
alexa skills kitsubmission testing certification
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
Lambda really likes to stay within the Amazon ecosystem. What are you calling? Any chance you can relocate it to, say, an Elastic Beanstalk service? Most of my skills use a Lambda function to pass through to a web service that's located in Elastic Beanstalk and the response is satisfactory. The other thing to consider is that I think you may incur charges if you connect from Lambda to something outside your data center. I'm not 100% sure about that. I may be thinking of another service. But if you are exchanging lots of information, then you may want to look it up. If they are just small packets, it probably isn't a problem.
10 |5000

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

Mike avatar image
Mike answered
I'm attempting to control my roku through the Echo. I was originally calling a node server on my local network, which would in turn make the call to the roku. But trying to speed it up, for testing I've been calling the roku directly. Just to clarify something I said above. When I said I tested the call I'm making using a rest client, I'm not on the same network, so, in theory it would be the same or similar speed as the lambda call.
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
I don't think you can make a comparable environment to where the Lambda function executes. It's off in Amazon's data center. No telling how many firewalls and routers are between it and your server. Are you just pushing data to Roku, or doing a push and a pull? If it's just a push, you might push to something on Elastic Beanstalk, which, in turn, pushes to your Roku. If push and pull, you might have a service on EB that polls your Roku. Then again, it looks like you are doing a single-user hobby skill. You can put your whole skill on EB. If you never publish it, you won't have to worry about having a signed certificate.
10 |5000

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