Quick Start: Alexa Skills Kit Command Line Interface (ASK CLI)

Prashant Bhatasana
AppGambit
Published in
5 min readOct 9, 2020

In this article, we are talking about how to configure ASK-CLI to create and manage Alexa skill using Command Line Interface.

The Alexa Skills Kit Command Line Interface (ask-cli) is used to create, manage, and deploy Alexa skills from the command line. ASK CLI is a tool for you to manage your Alexa skills and related resources, such as AWS Lambda functions. With ASK CLI, you have access to the Skill Management API, which allows you to manage Alexa skills programmatically from the command line.

Please see the full documentation from ASK CLI quick start guide.

Prerequisites

Before installing ASK CLI, make sure to have the following prerequisites:

$ pip install awscliTo upgrade the aws cli to the latest version,
$ pip install awscli –upgrade

To verify your installation, check your version of AWS. Open a command prompt, then type

$ aws --version

You should see your AWS CLI version.

Create AWS credentials

If you have an IAM user you can skip this step otherwise please follow this link to create AWS Credentials.

AWS-CLI configure

Open a terminal and type the following command.

$ aws configure

So, now we can configure ASK CLI.

Let’s Configure AKS CLI

  • Install ask-cli
npm install -g ask-cli
  • Once that’s done, verify the ask-cli installation
ask --version
  • Now, we’ll need to link accounts. To start that process, run the ask command along with the configure:
$ ask configureThis command will configure the ASK CLI with a profile associated with your Amazon developer credentials.
------------------------- Step 1 of 2 : ASK CLI Configuration -------------------------
? Please create a new profile or overwrite the existing profile.
Create new profile
? Please provide a profile name or press enter to use default as the profile name: <ENTER NAME OF YOUR PROFILE>
[Warn]: ASK CLI uses authorization code to fetch LWA tokens. Do not share neither your authorization code nor access tokens.
Switch to "Login with Amazon" page and sign-in with your Amazon developer credentials.
If your browser did not open the page, try to run the command again with "--no-browser" option.
Listening on http://localhost:9090...

This interactive command opens a web browser so you can sign in to your Amazon Developer account.

Once sign-in is successful. Close the browser and continue.

  • If you’re on a computer without a browser installed, you can use the ask configure --no-browser the command to complete initialization.
$ ask configure --no-browser
This command will configure the ASK CLI with a profile associated with your Amazon developer credentials.
------------------------- Step 1 of 2 : ASK CLI Configuration -------------------------
? Please create a new profile or overwrite the existing profile.
Create new profile
? Please provide a profile name or press enter to use default as the profile name: <ENTER NAME OF YOUR PROFILE>
[Warn]: ASK CLI uses authorization code to fetch LWA tokens. Do not share neither your authorization code nor access tokens.
Paste the following url to your browser:
https://www.amazon.com/ap/oa?response_type=code&client_id=amzn1.application-oa2-client.aad784f7ffse44b980cs45s445s77s87&state=Ask-SkillModel-ReadWrite&scope=alexa%3A%3Aask%3Askills%3Areadwrite%20alexa%3A%3Aask%3Amodels%3Areadwrite%20alexa%3A%3Aask%3Askills%3Atest%20alexa%3A%3Aask%3Acatalogs%3Aread%20alexa%3A%3Aask%3Acatalogs%3Areadwrite%20alexa%3A%3Aask%3Asubscriptions%20alexa%3A%3Aask%3Askills%3Adebug&redirect_uri=https%3A%2F%2Fask-cli-static-content.s3-us-west-2.amazonaws.com%2Fhtml%2Fask-cli-no-browser.html
? Please enter the Authorization Code:

Open link with any browser and login > It will return Authorization Code

Copy Code and paste it into the console.

Now, Assosiate an AWS Profile with ASK-CLI

------------------------- Step 2 of 2 : Associate an AWS Profile with ASK CLI -------------------------
[Warn]: ASK CLI will create an IAM user and generate corresponding access key id and secret access key. Do not share neither of them. Do you want to link your AWS account in order to host your Alexa skills? (Y/n)

Enter Y .

? Please create a new profile or overwrite the existing profile. [<NAME OF YOUR PROFILE>] "<NAME OF YOUR PROFILE>" 
[Warn]: ASK CLI uses authorization code to fetch LWA tokens. Do not share neith• r your authorization code nor access tokens.
Switch to "Login with Amazon" page and sign-in with your Amazon developer creden tials.
If your browser did not open the page, try to run the command again with " --no-b rowser" option.
ASK Profile "default" was successfully created. The details are recorded in ask cli config file (.ask/cli_config) located at your **HOME** folder.
Vendor ID set as M2A4ZLREOC2518.
------------------------- Step 2 of 2 : Associate an AWS Profile with ASK CLI -------------------------
[Warn]: ASK CLI will create an IAM user and generate corresponding access key id and secret access key. Do not share neither of them. ? Do you want to link your AWS account in order to host your Alexa skills? (Y/n)

Enter Y .

------------------------- Step 2 of 2 : Associate an AWS Profile with ASK CLI ------------------------- 
[Warn]: ASK CLI will create an IAM user and generate corresponding access key id and secret access key. Do not share neither of them.
? Do you want to link your AWS account in order to host your Alcoa skills? Yes
? Please choose from the following existing AWS profiles or create a new one.
> default
alexaws
-----------------
Create new profile
-----------------

Great, we configured ask-cli successfully.

Please choose from the following existing AWS profiles or create a new one. default 
AWS profile "default" was successfully associated with your ASK profile "<NAME OF YOUR PROFILE>"
------------------------ Configuration Complete ------------------------
Here is the summary for the profile setup: ASK Profile: default IAWS Profile: <NAME OF YOUR PROFILE>

In my next article, we will see how we can create and manage Alexa skills using The Alexa Skills Kit Command Line Interface (ASK-CLI).

Thank you for reading, if you have anything to add please send a response or add a note!

--

--

Prashant Bhatasana
AppGambit

AWS Community Builder | AWS Certified | Terraform Associate | DevOps Engineer, Love to work with #AWS #Terraform #Jenkins #Kubernetes #Docker #Ansible #Selenium