We are excited to announce that if you deploy our AWS Trivia Alexa Skill from Stackery we will send you AWS Credits ($50 value)!
Oh, and bonus points for playing the quiz game - find it here: Stackery re:Invent Quiz Alexa Skill.
A Skill is a voice app that can be opened on an Alexa-enabled device, such as a smart speaker, a smart home device that's Alexa-enabled, a smartwatch.
This Skill asks users questions about AWS services, such as Lambda, Cognito or EC2, in a 10-question quiz game. It also gives users facts about certain AWS services.
Nope! Stackery makes it easy for anyone to deploy serverless apps on AWS, and adding infrastructure is as simple as dragging and dropping! You just need an AWS account, a modern browser, and a computer connected to the Internet.
No! If you can copy-paste, you can build and deploy this app. If you want to customize the quiz, you will need to know basic JavaScript.
No. The Alexa developer console includes an in-browser Alexa simulator for testing.
Everything should fit easily within AWS's free tier, and the AWS account and Amazon Developer account are free.
Sadly, no (believe me, I tried). But there are some cool things you can do with SSML, the markup language used to dictate how Alexa generates phrases.
Yup. Terms and conditions apply. While supplies last. Credit usages must follow AWS terms and conditions. Amazon Echoes based on availability. Shipping may be extra.
You'll now see your newly-created skill in a list of all skills:
This is where you will paste a JSON file that describes the different forms of interactions your Skill will have with users, as well as the custom data that serves as the allowable answers to quiz questions.
Once you save, you will see that your Intents were auto-populated. Feel free to poke around and view the sample utterances and slot types that are there now. When you're done, return to the main console where all of your skills are listed, as you'll need to get your Skill ID in a few moments, so be sure to leave this browser tab open.
For this step you'll need a free Stackery account, a Git provider, and a code editor. If you're a first-time Stackery user, you'll need to link your Git provider and AWS account the first time you commit and deploy a stack. Don't worry, the process is fairly quick and simple and the app will walk you through it.
AlexaHandler
and change its code source directory to src/AlexaHandler
. Scroll down and hit SaveProperties
of your AlexaHandler
function:
Events:
AlexaSkillEvent:
Type: AlexaSkill
SkillId: [your-skill-id]
[your-skill-id]
with the Skill ID
you noted above1This is what allows your Lambda function to be accessed by the specific skill you are building, and not any other.
Your template should look now something like this:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
AlexaHandler:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub ${AWS::StackName}-AlexaHandler
...
Policies:
- AWSXrayWriteOnlyAccess
Events:
AlexaSkillEvent:
Type: AlexaSkill
SkillId: amzn1.ask.skill.some-long-numbers-and-letters
Parameters:
...
If you want to double-check your formatting, you can refer to our SAM template in the tutorial repo.
When you created a function in Stackery, it stubbed out some function code for you in the chosen runtime, which is Node 12 in this case. We're going to replace the function code with the Alexa backend from the tutorial repo, as well as its package.json
contents to add the required dependencies.
your-repo/src/AlexaHandler/index.js
and replace its contents with the contents of Stackery's Alexa Skill code. Save the fileyour-repo/src/AlexaHandler/package.json
and replace its contents with the following and save:{
"name": "alexahandler",
"version": "1.0.0",
"description": "",
"main": "index.js",
"author": "Stackery",
"license": "MIT",
"devDependencies": {
"aws-sdk": "^2.796.0"
},
"dependencies": {
"ask-sdk-core": "^2.9.0",
"ask-sdk-model": "^1.34.1"
}
}
If you kept your Stackery tab open, you'll have noticed that it detected the changes you pushed up. Go ahead and hit the refresh link:
This will take a few minutes - get yourself a coffee and a pat on the back, because you're 90% done with deploying your first Alexa Skill!
AlexaHandler
function to pull up some handy data and links.This is it: the final stage, when we connect all the dots and test our Alexa Skill!
Now you're ready to test your Skill! Navigate to Test, and say or type "Start Stackery re:Invent Quiz" to kick off the quiz. You can try the quiz yourself, or get some trivia information about specific AWS services. Knock yourself out - this is the fun part!
Return to the Stackery Dashboard, notice that your function was successfully invoked while you were testing!
Hopefully, this tutorial piqued your interests in building Alexa Skills. With a Lambda backend, you can build skills in just about any runtime, and Stackery helps you deploy changes quickly (and automatically with our Deployment Pipelines).
I'd love to see what you build - feel free to send your projects my way on Twitter, and don't forget to send your deployed stack to Stackery on Twitter.
1 For the sake of this tutorial, we are hard-coding the Skill ID. If you are saving your Skill ID directly in the template, make sure your repo is private. Alternatively, you can use Stackery's Environments and Parameter Store to follow best practices and store your Skill ID as in AWS's Systems Manager Parameter Store and reference it at build time.
2 This tutorial walks you through deploying manually in the browser, but there are other ways to deploy that will likely suit your workflow better. You can deploy with the Stackery CLI with just one command, or completely automate this process upon a merge to the repo's main branch, including automated test runs, with Stackery's Deployment Pipelines.
Use Machine Learning to detect objects in an image