Quick Start: Alexa Skills Kit Command Line Interface (ASK CLI)
The Alexa Skills Kit Command Line Interface (ASK CLI) is a tool that you can use to manage your Alexa skills and related resources, such as AWS Lambda functions. With the ASK CLI, you have access to the Skill Management API, which enables you to manage Alexa skills programmatically from the command line.
- For an overview of the ASK CLI, see ASK CLI Overview.
- For the ASK CLI command reference, see ASK CLI Command Reference.
Step 1: Prerequisites for using ASK CLI
Before you install the ASK CLI, make sure you have the following prerequisites:
- An Amazon developer account. Sign up is free.
- Node.js and
npm
, which comes with Node.js. The ASK CLI requires Node.js version 14 or higher, but we recommend that you use the current release or active LTS version of Node.js. To install or update your version of Node.js, refer to the Node.js downloads page. To check your version of Node.js, open a command prompt, then typenode --version
. - Git, for cloning skills from templates in Git repositories. See Installing Git in the Git documentation.
Important: If you want to be able to create Alexa-hosted skills by using the ASK CLI, you must install Git.Note: If you install Git for Windows from https://git-scm.com/download/win, make sure to select the Enable symbolic links option during installation.
Step 2: Set up an AWS IAM user
If you use AWS Lambda to host your skill's backend logic, then you need AWS credentials. Make sure that your AWS credentials are set up, with the appropriate permissions, on the computer to which you are installing the ASK CLI. For more information, see Create AWS credentials.
If you are not using AWS Lambda, you may point skills to your own endpoint, while still using ASK CLI to manage your skill's model.
Step 3: Install and initialize the ASK CLI
Use npm
to install the ASK CLI.
npm install -g --production windows-build-tools
.To install the ASK CLI:
- Installation might require that you run as an administrator or super user. On Windows, open PowerShell with the Run as Administrator option. On Linux or macOS, use
sudo
. -
Open a command prompt, then type
npm install -g ask-cli
.Note: If you only use Alexa-hosted skills, you don't need to link an AWS account during ASK CLI setup.
If you already have the ASK CLI installed and want to update to the latest version, install it in the same way as a new user.
The first time you use the ASK CLI, you must use the ask configure
command to initialize the ASK CLI with your Amazon and AWS credentials. For more information, see configure command. The ask configure
command prompts you to name your ASK profile, choose the AWS profile to use, and then opens a browser so you can sign in to your Amazon developer account. If you're on a computer without a browser installed, you can use the ask configure --no-browser
command to complete initialization. After the initialization is complete, you can use ASK CLI to create or manage your skill.
Step 4: Use the ASK CLI commands to manage your skill
Use the ASK CLI commands to manage your skill. For example, you can do the following:
-
Use the ask new command to create a new skill project from a template. The newly created skill project folder contains all the necessary files to deploy a skill, with only minimal changes. For details, see Create a new skill project.
-
Use the ask deploy command in your skill project directory to deploy your skill to your developer account. If you have your AWS credentials set up and your skill is configured to use AWS Lambda, this command automatically deploys your skill code. For details, see Deploy a skill project to the development stage.
Step 5: Test your skill locally
If you are building your skill, use the ask run command to start a debugging session to test your skill locally. Then use the ask dialog to send requests to your skill locally. For details and prerequisites, see Test your skill locally.
Step 6: Test your skill
The ask deploy command automatically enables your skill for testing. If your skill is already deployed, use the ask dialog command to send requests to your deployed skill. For details, see Test your skill.
Troubleshooting
If you have problems with the ASK CLI, review the following troubleshooting solutions.
Issue: No installation privileges
Symptoms
When you try to install the ASK CLI, you encounter an installation privilege error.
Try this
On Windows, start the command prompt with administrator privileges. Although this error rarely occurs on Mac and Linux systems, we recommend using the sudo
command.
Issue: Incorrect AWS credentials
Symptoms
When you call ask deploy
, you encounter an error regarding your AWS credentials. For example, if there are multiple AWS profiles and you select a profile that doesn't have AWS credentials set up with ask init
, you might get the following error message.
[code] [Error]: Cannot find the environment variable: AWS_ACCESS_KEY_ID
Try this
This error occurs because your AWS credentials aren't set up correctly in your AWS profile. Set the appropriate profile by using the ask init
command again.
To view the config file, go to the following file:
- Linux/Mac: ~/.ask/cli_config
- Windows: %USERPROFILE%.ask\cli_config
Issue: Can't find the vendor ID associated with the current profile
Symptoms
When you attempt to install the ASK CLI, the installation process can't find your vendor ID.
Try this
This error occurs when the developer account information is insufficient. Visit your developer account settings and make sure that your account settings include your phone number and credit card information.
amazon.com
, you have a US account. If you create skills for Japan, you must have an amazon.co.jp account
, so be sure to create an account on amazon.co.jp
.Issue: Lambda function can't be created or cloned
Symptoms
The ASK CLI reports that it can't create or clone a Lambda function.
Try this
This error occurs when the AWS account information is insufficient or the AWS Identity and Access Management (IAM) policy isn't set up correctly. To see your AWS account settings, go to Account. For details about using IAM policies with the ASK CLI, see Manage Credentials with the ASK CLI.
Related topics
- Test and Debug Your Skill
- Test your skill in the developer console
- Test Skills in Visual Studio Code
Last updated: Jan 26, 2024