Your Alexa Consoles
?
Support
Fact Skill Tutorial

Build an Alexa Skill in 6 Steps

Step 2: Setting Up A Lambda Function Using Amazon Web Services

In the first step of this guide, we built the Voice User Interface (VUI) for our Alexa skill. On this page, we will be creating an AWS Lambda function using Amazon Web Services. You can read more about what a Lambda function is, but for the purposes of this guide, what you need to know is that AWS Lambda is where our code lives. When a user asks Alexa to use our skill, it is our AWS Lambda function that interprets the appropriate interaction, and provides the conversation back to the user.

  1. Go to http://aws.amazon.com and sign in to the console. If you don't already have an account, you will need to create one. If you don't have an AWS account, check out this quick walkthrough for setting it up.

    Developer Console

  2. Click "Services" at the top of the screen, and type "Lambda" in the search box. You can also find Lambda in the list of services. It is in the "Compute" section.

    Lambda

  3. Check your AWS region. AWS Lambda only works with the Alexa Skills Kit in these regions: US East (N. Virginia), US West (Oregon), Asia Pacific (Tokyo) and EU (Ireland). Make sure you choose the region closest to your customers.

    Check Region

  4. Click the orange "Create function" button. It should be near the top of your screen. (If you don't see this button, it is because you haven't created a Lambda function before. Click the blue "Get Started" button near the center of your screen.)

    Create lambda function

  5. There are three boxes labeled "Author from scratch", "Blueprints" and "Serverless Application Repository". Click the radio button in the box titled "Serverless Application Repository" We have created an application in the repository as a shortcut to getting everything set up for your skill.

  6. Enter fact to search for the application repository named alexa-skills-kit-nodejs-factskill. Enter the full name into the search box if you need to narrow the search results.

  7. Click on the application. This template will create the Lambda function, grant the Alexa Skills Kit permission to invoke it, and set up an IAM role for you. It will also add the code from this GitHub repo and include the required dependencies so that you don't have to upload them yourself.

  8. Change the application name if so desired and then Click the deploy button at the bottom of the page.

  9. Wait for the status of all (three) resources to change to CREATE_COMPLETE. The banner at the top will also change to say Application successfully deployed.

  10. Open the function that was just created in the Lambda console by clicking on the link in the list of resources. It is normally the first resource and the only link in the list.

  11. (Optional, but recommended) To secure this Lambda function follow the instructions found here

  12. Scroll down the page until you see a section called Function code.

  13. You are not required to make any changes, however for your knowledge, the code which was pre-loaded into the function comes from here. If you modify the code, be sure to click "Save".

  14. You should see the Amazon Resource Name (ARN) for this function in the top right corner of the page. (You may need to scroll back up.) Copy the ARN value for this Lambda function for use in the next section of the guide.

    Copy ARN

You're now ready to connect the VUI to the code.