Skip to content

Latest commit

 

History

History
60 lines (49 loc) · 3.11 KB

page2.md

File metadata and controls

60 lines (49 loc) · 3.11 KB

Creating the Lambda

We will go back to aws.amazon.com

Once you've signed in, click on "Services" at the top of the screen. Search for "Lambda." It should be the choice with the description, "Run Code without Thinking about Servers."
Please click that option.

The Lambda management console

Welcome! You are now in the Lambda management console. This is where all of your Lambda functions will be located.

  1. Please select, "Create a new function."
  2. Select "Blueprints" from the top columns
  3. Scroll down if needed and click on the "alexa-skill-kit-sdk-factskill" blueprint. This will provide fantastic boilerplate code for us to build off of.
  4. I like to name my functions as [SkillName] + "Intent," as this helps me keep track of the relationships between my Lambdas and my skills. If you have a better idea in mind, you can name your Lambdas however you wish!
  5. If this is your first Lambda, select "Creat a custom role" in the Role menu. In the screen that opens up, simply click Allow. You just allowed the Lambda service the permissions it needs to run your code, to summarize the IAM significance.
  6. Now, we will select "lambda-basic-execution" in the Existing Role section, should that not have already been selected. This is the role we just created.
  7. Scroll down and give the Create Function button a nice click!
  8. Congratulations! You just made a Lambda function! Yayyyyy

Connect the Alexa trigger

To activate the Lambda function via Alexa, we have to connect the Alexa Skills Kit trigger.

From the Add Triggers column on the lefthand side, look for "Alexa Skills Kit."
If you can't find it, look at the top right of your screen next to "Support." To the left of Support is the name of the AWS region where we are hosting our code...it should say, "N. Virginia," as this is the region that supports Lambda. If it is a different region, simply click the region name and select N. Virginia.
You should be able to see Alexa Skills Kit in the triggers section now.

Nice work! You just made a Lambda function that can be triggered by any Alexa-enabled device.

Connect the Lambda to the skill itself

In the top right corner of your Lambda is a value that reads as ARN - arn:aws:lambda:us-east-1:XXXXXX...
Please copy this value from "arn:aws..." through the end after the name of the Lambda.

Head back to the Alexa skill builder and go to this skill's interface. Select "Endpoint" in the left sidebar.
Select AWS Lambda ARN and paste the value you just copied into "Default Region."

We just connected this skill's voice interface (frontend) to the logic processing code (backend) with the ARN value. The reason this feature exists is to permit developers to create their own endpoints to process the Alexa requests in a manner desirable to them.