Serverless Amazon Alexa Skills

Originally published at www.stackery.io.


After doing the standard “Hello World” serverless program, I didn’t know where to go next. What would be a simple but interesting project? It was pointed out to me that I could build an Amazon Alexa Skill using serverless. Since I had recently acquired a new Amazon Echo, this seemed like an exciting project to get started on.

Alexa is the personal voice service on the Echo device. It can be used for a variety of things, and those things can be expanded by creating your own skills for it. Skills are basically apps for the Alexa program.

Amazon gives you two options for a backend when building an Alexa Skill. You can either use a custom endpoint with HTTPS or you can use AWS Lambda. Using Lambda allows you to focus less on the infrastructure and more on the interesting parts of building a skill. Besides the benefit of not having to worry about infrastructure and figuring out how to host your own custom Alexa skill, using Lambda ends up being a very frugal option. With the AWS Free Tier you are given 1 million free requests and up to 3.2 million seconds of compute time per month. This is more than enough for you to host your soon to be created custom Alexa skill. If when you finish building your skill, you make it live (publish it and allow other Amazon users to download it) Amazon now has promotional credits for Alexa that allow you to build and host most Alexa skills for free.

Because of the frugality of using serverless technology and the fact that Amazon wants you to use their services to host the skills you are building, Amazon makes it fairly easy to build a Custom Alexa Skill using Lambda. I followed this tutorial from Amazon to get started, but changed the skill I was creating to something more interesting to me. The main limitation of using Lambda to host your skill versus hosting it yourself as a web service, is that Lambda doesn’t allow you to code in any programming language. It does support enough languages that it shouldn’t really be a problem. You are able to write your skill using Node.js, Java, Python, or C#, which worked well enough for me.

Building a Custom Alexa Skill is a good way to get your feet wet with serverless technology. It is an easy enough process that allows you to start getting familiar with using AWS Lambda. And you can build something you will actually be able to use and interact with.