Catalin Morosan avatar image
Catalin Morosan asked

AWS Lambda + account linking + small database

Hi all, I am working on implementing a skill with Alexa and I am looking to find the simplest solution to achieve what I need. I am not familiar with the Amazon web services and I am having trouble in deciding my architecture. Basically, it seems using AWS Lambda with Alexa is the most straightforward thing to do. I also need to use account linking which means I need to create an url and a login page. Can I do this also with AWS Lambda? (I just need the email and password and then I can use an already existing custom API to to get the user data that I need) If no, which Amazon offerings should I use for the login page and how can I save the (userId, user) mapping so I can access it later? And finally I need a small database where I can store the (userId, user) mapping needed by AWS Lambda to know for which user to do the action. I don't think AWS Lambda has support for databases. Does it? If not, what Amazon offering should I use? So basically, what I am asking for is the big picture view of how the architecture would look like for implementing a skill with account linking and using Amazon services. Thanks.
alexa skills kitdebugging
10 |5000

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

1 Answer

jjaquinta avatar image
jjaquinta answered
The two biggest advantages to Lambda is that it's free and you don't need to muck about with certificates. The biggest disadvantages to Lambda is that it is stateless and single threaded. So, for account linking, you are going to have to maintain some sort of state. To do this in Lambda, you are going to have to back-end it with a database, such as DynamoDB. However, you are going to have to do a DB lookup (and a DB store) every single call in Lambda. You can't background any of this and you can't cache any of this. This will add latency and reduce the responsiveness of your skill. An alternative which many people are doing is to use a simple pass-thru Lambda function that just forwards the request to a standard web server. I run my server on Elastic Beanstalk, but since you are no longer limited by certificates, you can run it anywhere you like, and use whatever language you like. That's the short answer. There's a longer discussion about it in my book:
10 |5000

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