AWS GoT Hack: Lambda Function

To recap, I'm working on a 48-hour hack to help learn about AWS.  My goal is to:

Create a "Game of Thrones" Alexa Skill that allows the user to ask if a character is alive or dead, and responds with an accurate answer.

In the previous post, I created most of the very simplest implementation of our Alexa Skill.  Now we need to go write the code that backs up that skill. We'll be using AWS Lambda.

One creates a Lambda function from the Lambda Management Console. I'll skip the blueprint and configure the trigger to be the "Alexa Skills Kit".

Configuration

The configuration page is a bit more complex:

  1. I'll name the function "GoT-Skill"
  2. I'll use the Node.js runtime. 
  3. When I actually start coding, I'm going to upload a .ZIP file, rather than enter the code into a form field. However, just to get the function set up, I'm going to leave the template code here.
  4. I'll create a basic execution role.
    1. "Create a new IAM Role"
    2. Name it "LambdaBasicExecution"
    3. Hit "Allow"
    4. Launch IAM Management Console
    5. Select "LambdaBasicExecution"
    6. Hit "Attach Policy"
    7. Select "AWSLambdaBasicExecutionRole"
    8. Hit "Attach Policy" 
    9. Select "Choose an existing Role" and "LambdaBasicExecution". I had to wait a minute or so for the new role to appear.
  5. I'll leave the Advanced settings the way they are.
  6. Review the function and accept it.

OK, so now I have a very basic Lambda function that really does nothing.  But, at the top of this page I do have something I need: the ARN. I'll copy that, go back and paste it into my Alexa Skill.

Testing Alexa Skill

Now I can test my Alexa Skill. I'll enter an utterance ("where do you get your data") and see what happens.

The request JSON shows that the utterance is mapping correctly to the "Attribution" intent, but the response is:

The remote endpoint could not be called, or the response it returned was invalid.

Well, that actually makes sense as I haven't actually added any code to the template. I should go do that.

Lambda Code

Before I start writing code, I want to create a repo in which to store that code. I could do that using Github, but I'm trying to use a lot of AWS services, so I'm going to try AWS CodeCommit in the next blog post.

AWS GoT Hack: Alexa Skill

Read More

48-hour AWS Hack

Read More