Build an Amazon Alexa Skill with AWS Lambda Function (Blueprints)

Back again with a new post to build Amazon Alexa Skill with AWS Lambda Function using preconfigured template (Blueprints). We are going to use preconfigured template created with Node.js in this tutorial. As this is first post with Alexa, So we can go with the overview of Amazon Alexa Skill and AWS Lambda.

What is Alexa Skill?

Alexa is Amazon’s voice service and the brain behind tens of millions of devices like the Echo family of devices including Echo Show and Echo Spot. Alexa provides capabilities, or skills, that enable customers to create a more personalized experience.

What is AWS Lambda?

AWS Lambda is a compute service that lets you run code without provisioning or managing servers. AWS Lambda runs your code on a high-availability compute infrastructure and performs all of the administration of the compute resources, including server and operating system maintenance, capacity provisioning and automatic scaling, code monitoring and logging. All you need to do is supply your code in one of the languages that AWS Lambda supports (currently Node.js, Java, C#, Go and Python).

How to build an Amazon Alexa Skill with AWS Lambda?

We need few things to build an Amazon Alexa Skill with AWS Lambda, Here are the below

  • AWS account
    • We need AWS account to create a AWS Lambda Function, So please create your account at aws.amazon.com. You can also checkout the step to create and activate a new Amazon Web Services account at Knowledge Center. Try enabling AWS Free Tier to gain free, hands-on experience with the AWS platform, products, and services.
  • Amazon Developer Services
    • Amazon Developer Services is needed to create, test and launch our Alexa Skills. Create your account at Developer Console

Setup AWS Lambda

  • On AWS Dashboard, Select US East (N. Virginia) region on top right – this is the only region with Alexa/Lambda free tier service.
  • Select Lambda under Compute and click Create a Lambda Function.
  • Under Select Blueprint, search for alexa-skill-kit-sdk-factskill (Node.js) and choose that blueprint.
  • Once Blueprint is selected, Click Configure
  • Now give your function name (e.g. sampleFacts)
  • Add a new role for lambda_basic_execution (note IAM role in next step. Note also if you have already used lambda you may already have a ‘lambda_basic_execution’ role created you can use.).
  • You will be asked to set up your IAM role if you have not done so.
  • Click Create Function to finish the setup
  • Note the ARN on the top right (We need this ARN information later)

Setup Alexa Skills

  • On Amazon Developer Portal,  Go to Alexa Skills Kit Developer Console
  • Click Create Skill, Enter the name of your skill (e.g. sampleFacts)
  • On choose a model to add to your skill step, Choose Custom and then click Create skill. Now Alexa Skill is created successfully.
  • Enter an invocation name for your skill (e.g. samplefacts). This name is used to invoke your skills from Alexa devices.
  • Add your Intents, Samples, and Slots, Just copy and paste the JSON from Git to JSON Editor on Alexa Skill.
  • On Endpoint, Choose AWS Lambda ARN as service endpoint type and add your ARN (Which we got from AWS Lambda) at Default Region.
  • Copy your Alexa Skill ID (We need this Skill ID later)
  • Click Build Model to build your Alexa Skill
  • Finally, Your Alexa Skill setup completed successfully

Connect Alexa Skills With AWS Lambda

  • Go back to your Lambda Function which we have created before at AWS console
  • On Configuration Section, Add Alexa Skills Kit as your triggers.
  • Click on your Alexa Skills Kit trigger, Go to Configure triggers at bottom
  • Enable Skill ID verification and Put your Alexa Skill ID (Which we got from Alexa Skills).
  • Click Add and then Save
  • Alexa Skills and AWS Lambda connected successfully

Test your Alexa Skills

  • At your Alexa Skills Kit Developer Console, Go to your skill and then click Test
  • Enable test for your skill.
  • Now, You can begin your interaction with Alexa by typing or giving your voice (e.g. open samplefacts)

You can also check this article as video tutorial on youtube, Check below

Hope, you will have developed voice interaction application
Please leave your valuable comments/suggestions/feedback on below comment box if any.
Thank You !!

Siva Sankar

SIVA SANKAR, Working as a Software Engineer, Blogging is my hobby. I completed my Bachelors of Engineering (Computer Science Engineering) in Chennai, India. and my Master of Engineering (Embedded System Technologies) in Tamilnadu, India.

Leave a Reply

Your email address will not be published. Required fields are marked *