Create and Manage Alexa-Hosted Skills


You can use the Alexa developer console to create and manage Alexa-hosted skills. For more details about hosted skills, see About Alexa-hosted Skills.

You can also create an Alexa-hosted skill in the following alternate ways:

  • You can create an Alexa-hosted skill by using the developer console and importing a skill project from a public Git repository.
  • You can create an Alexa-hosted skill by using the ASK CLI.
  • You can create an Alexa-hosted skill by using VS Code.

Create an Alexa-hosted skill in the console

You can create an Alexa-hosted skill in the developer console by using the following procedure.

To create an Alexa-hosted skill in the console

  1. Open the Alexa developer console and log in.
  2. Click Create Skill. The Create a new skill page appears.
  3. At the top of the page, for Hosting region, accept the default or choose a new hosting region. The hosting region determines the location of your Amazon S3 bucket and Amazon DynamoDB table. For details, see Hosting your skill resources in different AWS Regions.
  4. For Skill name, enter a name.
  5. For Default language, choose a language.
  6. For Choose a model to add to your skill, select Custom.
  7. For Choose a method to host your skill's backend resources, select Alexa-Hosted (Node.js) or Alexa-Hosted (Python).
  8. Click Create Skill. The Choose a template to add to your skill page appears.
  9. Choose a template and click the Continue with template button, or click the Import skill button. For details, see Import an Alexa-hosted Skill from a Public Git Repository. After about one or two minutes, your skill appears in the console open to the Build page.

After you create your skill, the voice model, Amazon Web Services (AWS) resources, and code editor activate, and the developer console initiates a build process for the voice model.

You can store audio and visual files in Amazon S3 to use with your Alexa-hosted skill. For details, see Use Media Files with Your Alexa-Hosted Skill.

You can store data in Amazon DynamoDB to use with your Alexa-hosted skill. For details, see Use DynamoDB for Data Persistence.

Add dependencies

Alexa provisions AWS CodeBuild as part of your skill to run the build script. NPM (Node.js) or pip (Python) runs automatically as part of the build script. You can add new libraries and dependencies to your skill, and dependencies are fetched and built when you click the Deploy button.

  • Node.js — Add dependencies in the dependencies section of your package.json file:

    "i18next": "^10.5.0"
    
  • Python — Add dependencies in the dependencies section of your requirements.txt file. For example:

    boto3==1.9.216
    

View Amazon CloudWatch logs

Your Alexa-hosted skill automatically provides you with Amazon CloudWatch logs so you can access information critical to developing your skill.

For skills with Alexa-hosted endpoints in multiple regions, Cloudwatch logs appear separately for each region from which users access your skill. Logs that you generate when you test your skill by using the Test page in the console appear with the CloudWatch logs in the default hosting region for your skill. You choose the default hosting region for your skill when you create your skill, and afterwards it appears on the Endpoint tab of the Build page for your skill.

To view your CloudWatch logs

  1. Open the Alexa developer console and log in.
  2. In the list of your skills, click the name of the skill that you want to view.
  3. Click the Code tab.
  4. In the toolbar, click the arrow next to the Logs icon, and then choose your region.
    The AWS console opens to Amazon CloudWatch and your logs appear.
  5. To see the logs for your skill in other regions, change the region in the AWS console.

Convert an existing skill to an Alexa-hosted skill

You can convert an existing custom-model skill to an Alexa-hosted skill in the developer console by using the following procedure.

To convert an existing skill to an Alexa-hosted skill in the console

  1. Open the Alexa developer console and log in.
  2. In your skill list, click the name of your skill, or in the Actions column, choose Edit.
  3. Click Code to open the code page.
  4. Click Convert to Alexa-hosted. The Convert to Alexa-hosted dialog appears.
  5. For Programming language, choose Node.js or Python.
  6. For Hosting Region, choose the primary hosting region. The hosting region determines the location of your Amazon S3 bucket and Amazon DynamoDB table. For details, see Hosting your skill resources in different AWS Regions.
  7. Click Convert. After about one or two minutes, the console opens to the Code page.

After the console converts your skill to an Alexa-hosted skill, you must manually copy your skill code into the code editor. After your code is ready, click Deploy to build and deploy your skill code.

You can always revert your skill to self-hosted. For details, see Convert from Alexa-hosted to self-hosted.

Convert from Alexa-hosted to self-hosted

If you have an Alexa-hosted skill and you want to host it yourself, you must move any resources hosted in Amazon S3 and Amazon DynamoDB from your Alexa-hosted skill to your own storage. In addition, you must manually move your code to your new skill endpoint and change the endpoint of your skill in the developer console. You can download your skill to help convert your skill from Alexa-hosted to self-hosted.

Import your skill code

If you have skill code that you develop by using offline tools, such as the Alexa Skills Kit (ASK) Command Line Interface (CLI) or VS Code, you can import the skill code into the lambda folder in the Alexa-hosted skill repository. The import only brings in the skill code. Other artifacts, such as the voice interaction model and skill manifest, aren't imported.

You must meet the following requirements to import your code:

  • You must compress your code into a ZIP file archive.
  • Your archive must have a lambda folder under root.
    The import action copies files and folders from the lambda folder.
  • The archive and the files in the archive must be UTF-8 encoded.
  • The size of the archive must not exceed 50 MB.
  • You can import up to 100 files at a time. No file or group of files you import can exceed 6 MB in size.
    If the archive contains more than 100 files, import the remaining files by using multiple import actions.
  • The skill code in the archive must be the same language you selected when you created the backend resources for your skill, either Node.js or Python.

To import your skill code to the console

  1. Open the Alexa developer console, and then sign in.
  2. In the list of your skills, click the name of the skill that you want to edit.
  3. Click the Code tab.
  4. In the toolbar, click Import Code.
  5. In the Import Code dialog box, under Select archive, choose Browse to navigate to the ZIP file that contains your skill code.
  6. Select the archive file, and then click Open.
  7. To unzip the archive, click Next.
  8. Select the folders and files from the archive to import, and then click Next.
    Choose Back to select another ZIP file.
  9. To confirm the selected files, review the file list and the Amazon Developer Services Agreement, and then click Import.
    Choose Back to change the selected files.
    Or, choose Cancel to cancel the import.

    When you click Import, the console imports the selected files, and then saves them in the AWS CodeCommit repository.

  10. To deploy the imported code to your skill endpoint, click Deploy.

Download your skill

You can download your skill from the Code tab of your skill, either in the development stage or the live stage. In the development stage, you can download the skill with the latest code changes. In the live stage, you can download a copy of the live skill. The download package includes the skill's interaction model, source code files, and skill manifest.

To download a copy of your skill

  1. Open the Alexa developer console and log in.
  2. In the list of your skills, click the name of the skill that you want to download.
  3. Click the Code tab.
  4. In the upper left corner, click Download Skill.
  5. In the pop-up window, choose Continue.
  6. Save your skill as a .zip file.

Filter out skill availability checks

The hosted skills service periodically sends an availability check to your AWS Lambda function to verify that calls to AWS Lambda from your Alexa-hosted skill work properly. Alexa sends the availability check as a LaunchRequest from the user alexa-lambda-availability. If your skill performs an action when it receives a LaunchRequest, filter out requests from the user alexa-lambda-availability to prevent your skill from performing unnecessary actions.

The following code illustrates an availability check sent from Alexa to your skill.

{
  "version": "1.0",
  "session": {
    "new": true,
    "sessionId": "alexa-lambda-availability",
    "application": {
      "applicationId": "YOUR_SKILL_ID"
    },
    "user": {
      "userId": "alexa-lambda-availability"
    }
  },
  "context": {
    "AudioPlayer": {
      "playerActivity": "IDLE"
    },
    "System": {
      "application": {
        "applicationId": "YOUR_SKILL_ID"
      },
      "user": {
        "userId": "alexa-lambda-availability"
      },
      "device": {
        "deviceId": "test-device",
        "supportedInterfaces": {
          "AudioPlayer": {}
        }
      },
      "apiEndpoint": "https://api.amazonalexa.com",
      "apiAccessToken": "{token}"
    }
  },
  "request": {
    "type": "LaunchRequest",
    "requestId": "amzn1.echo-api.request.alexa.lambda.availability",
    "locale": "en-US",
    "shouldLinkResultBeReturned": false
  }
}

Update and deploy your skill

After you publish your Alexa-hosted skill, two versions of your skill appear in the development console: one for the development stage and one for the live stage. In the development stage, you can use the code editor to edit, save, and deploy your skill code. You can then click the Test tab and test your changes. This action doesn't affect the live behavior of your skill.

If you change the voice interaction model for your published skill, you must submit your skill for recertification. If you change only your AWS Lambda code, recertification isn't required, but Amazon validates your update by running automated security tests. You can promote the code from development to live by clicking the Promote to live button in the code editor. This action replaces the live code for your published skill, affecting the live behavior of the skill.

To update the live code for a published Alexa-hosted skill, Amazon recommends that you first make changes in the development stage, test the changes, and then click Promote to live. If you want to make a quick fix to your live code, you can make your change directly in the live stage code editor. However, you can't test your changes before you deploy to the live endpoint. To make a fix directly to your live code, open the code editor for the live stage, edit your code, and then click Deploy to live.

When you promote or deploy your updated code to the live endpoint, Amazon validates your update by running automated security tests. These tests take up to 5 minutes to complete. When the tests complete successfully, your updated code replaces the live version. If a test fails, Amazon blocks the deployment of your changes and notifies you of the reasons by email. You can address the issues and resubmit your code.


Was this page helpful?

Last updated: Nov 23, 2023