Tutorial: Create an Alexa Skill Project in AWS CodeStar - AWS CodeStar

On July 31, 2024, Amazon Web Services (AWS) will discontinue support for creating and viewing AWS CodeStar projects. After July 31, 2024, you will no longer be able to access the AWS CodeStar console or create new projects. However, the AWS resources created by AWS CodeStar, including your source repositories, pipelines, and builds, will be unaffected by this change and will continue to function. AWS CodeStar Connections and AWS CodeStar Notifications will not be impacted by this discontinuation.

 

If you wish to track work, develop code, and build, test, and deploy your applications, Amazon CodeCatalyst provides a streamlined getting started process and additional functionality to manage your software projects. Learn more about functionality and pricing of Amazon CodeCatalyst.

Tutorial: Create an Alexa Skill Project in AWS CodeStar

AWS CodeStar is a cloud‑based development service on AWS that provides the tools you need to quickly develop, build, and deploy applications on AWS. With AWS CodeStar, you can set up your entire continuous delivery toolchain in minutes, allowing you to start releasing code faster. The Alexa skill project templates on AWS CodeStar enable you to create a simple Hello World Alexa skill from your AWS account with just a few clicks. The templates also create a basic deployment pipeline that gets you started with a continuous integration (CI) workflow for skill development.

The main benefits of creating Alexa skills from AWS CodeStar are that you can get started with skill development in AWS and connect your Amazon developer account to the project to deploy skills to the development stage directly from AWS. You also get a ready to use deployment (CI) pipeline with a repository with all the source code for the project. You can configure this repository with your preferred IDE to create skills with tools you are familiar with.

Prerequisites

  • Create an Amazon developer account by going to https://developer.amazon.com. Signup is free. This account owns your Alexa skills.

  • If you do not have an AWS account, use the following procedure to create one.

    To sign up for AWS
    1. Open https://aws.amazon.com/, and then choose Create an AWS Account.

      Note

      If you previously signed in to the AWS Management Console using AWS account root user credentials, choose Sign in to a different account. If you previously signed in to the console using IAM credentials, choose Sign-in using AWS account root user credentials. Then choose Create a new AWS account.

    2. Follow the online instructions.

Important

After you create the Alexa skill project, make all edits in the project repository only. We recommend that you do not edit this skill directly using any other Alexa Skills Kit tools, such as the ASK CLI or ASK developer console. These tools are not integrated with the project repository. Using them causes the skill and repository code to become out of sync.

Step 1: Create the project and connect your Amazon developer account

In this tutorial, you create a skill using Node.js running on AWS Lambda. Most of the steps are the same for other languages, although the skill name differs. Refer to the README.md file in the project repository for details of the specific project template you choose.

  1. Sign in to the AWS Management Console, and then open the AWS CodeStar console at https://console.aws.amazon.com/codestar/.

  2. Choose the AWS Region where you want to create the project and its resources. The Alexa skill runtime is available in the following AWS Regions:

    • Asia Pacific (Tokyo)

    • EU (Ireland)

    • US East (N. Virginia)

    • US West (Oregon)

  3. Choose Create project.

  4. On the Choose a project template page:

    1. For Application type, choose Alexa Skill.

    2. For Programming language, choose Node.js.

  5. Choose the box that contains your selections.

  6. For Project name, enter a name for the project (for example, My Alexa Skill). If you use a different name, be sure to use it throughout this tutorial. AWS CodeStar chooses a related identifier for this project for the Project ID (for example, my-alexa-skill). If you see a different project ID, be sure to use it throughout this tutorial.

  7. Choose AWS CodeCommit for the repository in this tutorial and do not change the Repository name value.

  8. Choose Connect Amazon developer account to link to your Amazon developer account for hosting the skill. If you don't have an Amazon developer account, create an account and complete the registration first from Amazon Developers.

  9. Sign in with your Amazon developer credentials. Choose Allow, and then choose Confirm to complete the connection.

  10. If you have multiple vendor IDs associated with your Amazon developer account, choose the one that you want to use for this project. Make sure you use an account with the Administrator or Developer role assigned.

  11. Choose Next.

  12. (Optional) If this is your first time using AWS CodeStar in this AWS Region, enter the display name and email address you want AWS CodeStar to use for your IAM user. Choose Next.

  13. Wait while AWS CodeStar creates the project. This might take several minutes. Do not continue until you see the Project provisioned banner.

Step 2: Test your skill in the Alexa Simulator

In the first step, AWS CodeStar created a skill for you and deployed it to the Alexa skill development stage. Next, you test the skill in the Alexa Simulator.

  1. In your project in the AWS CodeStar console, choose View application. A new tab opens in the Alexa Simulator.

  2. Sign in with your Amazon developer credentials for the account you connected to your project in Step 1.

  3. Under Test, choose Development to enable testing.

  4. Enter ask hello node hello. The default invocation name for your skill is hello node.

  5. Your skill should respond Hello World!.

When the skill is enabled in the Alexa Simulator, you can also invoke it on an Alexa-enabled device that is registered to your Amazon developer account. To test your skill on a device, say Alexa, ask hello node to say hello.

For more information about the Alexa Simulator, see Test Your Skill in the Developer Console.

Step 3: Explore your project resources

As part of creating the project, AWS CodeStar also created AWS resources on your behalf. These resources include a project repository using CodeCommit, a deployment pipeline using CodePipeline and an AWS Lambda function. You can access these resources from the navigation bar. For example, choosing Repository shows details about the CodeCommit repository. You can view the pipeline deployment status in the Pipeline page. You can view a complete list of AWS resources created as part of your project by choosing Overview in the navigation bar. This list includes links to each resource.

Step 4: Make a change in your skill's response

In this step, you make a minor change to your skill's response to understand the iteration cycle.

  1. In the navigation bar, choose Repository. Choose the link under Repository name and your project's repository opens in a new tab or window. This repository contains the build specification (buildspec.yml), AWS CloudFormation application stack (template.yml), readme file, and your skill's source code in the skill package format (project structure).

  2. Navigate to the file lambda > custom > index.js (in case of Node.js.). This file contains your request handling code, which uses the ASK SDK.

  3. Choose Edit.

  4. Replace the string Hello World! in line 24 with the string Hello. How are you?.

  5. Scroll down to the end of the file. Enter author name and email address and an optional commit message.

  6. Choose Commit changes to commit the changes to the repository.

  7. Return to the project in AWS CodeStar and check the Pipeline page. You should now see the pipeline deploying.

  8. When the pipeline finishes deployment, test your skill again in the Alexa Simulator. Your skill should now respond with Hello. How are you?

Step 5: Set up your local workstation to connect to your project repository

Earlier you made a small change to the source code directly from the CodeCommit console. In this step, you configure the project repository with your local workstation so that you can edit and manage code from the command line or your favorite IDE. The following steps explain how to set up command line tools.

  1. Navigate to the project dashboard in AWS CodeStar, if necessary.

  2. In the navigation bar, choose IDE.

  3. In Access your project code, View instructions underneath Command line interface.

  4. Follow the instructions to complete the following tasks:

    1. Install Git on your local workstation from a website such as Git Downloads.

    2. Install the AWS CLI. For information, see Installing the AWS Command Line Interface.

    3. Configure the AWS CLI with your IAM user access key and secret key. For information, see Configuring the AWS CLI.

    4. Clone the project's CodeCommit repository onto your local workstation. For more information, see Connect to a CodeCommit Repository.

Next Steps

This tutorial showed you how to get started with a basic skill. To continue your skill development journey, see the following resources.