This is an opinionated template for Alexa skill development. It provides everything you need to start professional, test driven development right away.
This is a NodeJS Lambda function using serverless and the AWS CLI and skill defintion to be used by ASK CLI.
You need to install and initialize ASK CLI as a first step with
$ ask init
You need an AWS account and an Amazon developer account to create an Alexa Skill.
Now you can create a new skill project in the current directory.
$ ask new --template GettingStarted --url https://raw.githubusercontent.com/Pindar/alexa-template/master/templates.json --skill-name my_new_skill
You need to download NodeJS dependencies:
$ npm install
This repository requires a BASH command line interface.
Preperation
Create your .env.[test|dev|prod].yml
files based on lambda/custom/.env.example.yml
. You can add more configuration there and reference it in serverless.yml
or in your js function.
First: Deploy Lambda
- deploy to specified environment with
$ npm run deploy --prefix=lambda/custom -- --stage [green|blue] --config [dev|production]
- From the provided output of the last command copy the value of
SkillLambdaFunctionQualifiedArn
stripping off colon plus number (e.g.,:1
) and paste it as URI value in.ask/config
.
Second: Deploy Skill
$ npm run deploy
To have a seamless blue/green deployment experience with Alexa skills all three layers are independently managed.
- Alexa models and skill definition is deployed with ask-cli/Alexa Skill Management API (SMAPI)
- Lambda function is deployed with serverless framework
- Storage is deployed with aws-cli cloudformation templates
V1: GREEN is Live, BLUE is in development
+--------------------+ +----------------+ +-----------------+
| | | | | |
| Alexa Development +------> Skill BLUE +----------------> DynamoDB DEV |
| models | | | | |
| skill +----+ | | | |
+-+------------------+ | +----------------+ +-----------------+
|
|
+--------------------+ | +----------------+ +-----------------+
| | | | | | |
| Alexa Live +------> Skill GREEN +----------------> DynamoDB Prod |
| models | | | | | |
| skills +-+ | | | | |
+--------------------+ | | +----------------+ +-----------------+
| |
| | +-----------------+
| | | |
| +-----------------------------------> S3 Assets Store |
| | |
+--------------------------------------> |
+-----------------+
CERTIFICATION: BLUE connected to production database
+--------------------+ +----------------+ +-----------------+
| | | | | |
| Alexa Development +------> Skill BLUE +----------+ | DynamoDB DEV |
| models | | | | | |
| skill +----+ | | | | |
+--------------------+ | +----------------+ | +-----------------+
| |
| |
+--------------------+ | +----------------+ | +-----------------+
| | | | | +-----> |
| Alexa Live +------> Skill GREEN +----------------> DynamoDB PROD |
| models | | | | | |
| skills +-+ | | | | |
+--------------------+ | | +----------------+ +-----------------+
| |
| | +-----------------+
| | | |
| +-----------------------------------> S3 Assets Store |
| | |
+--------------------------------------> |
+-----------------+
V2: BLUE is Live, GREEN is in development
+--------------------+ +----------------+ +-----------------+
| | | | | |
| Alexa Live +------> Skill BLUE +----------+ | DynamoDB DEV |
| models | | | | | |
| skill +----+ | | +----------> |
+--------------------+ | +----------------+ | | +-----------------+
| | |
| | |
+--------------------+ | +----------------+ | | +-----------------+
| | | | | | +-----> |
| Alexa Development +------> Skill GREEN +-----+ | DynamoDB PROD |
| models | | | | | |
| skills +-+ | | | | |
+--------------------+ | | +----------------+ +-----------------+
| |
| | +-----------------+
| | | |
| +-----------------------------------> S3 Assets Store |
| | |
+--------------------------------------> |
+-----------------+