Writing Alexa Skills for the Amazon Echo Dot is pretty easy. You can start with the templates at Amazon Developer Blog. When you finished, you simply upload your code to AWS lambda as a Zip file. For a one-time deployment this is straightforward, but if you want to develop a professional application and have multiple deployments it is not a good way. Also if you use a build system like Jenkins, an automatic deployment would be mandatory.
To face this issue, at least if you develop with NodeJS, you can use a tool called “ClaudiaJS” (https://claudiajs.com/claudia.html).
With a simple command (claudia update) your NodeJS based skill gets zipped and uploaded. So this tutorial is about the configuration and usage of that tool.
First of all to configure ClaudiaJS for Lambda deployment, you need to have an AWS account with IAM and Lambda.
- Login to your AWS account and choose IAM
- Create a new group with the privileges IAM full access, Lambda full access and API Gateway Administrator
- Create a user and attach it to the group you created before
- Tick “Programmatic access”
- In the review tab, you can see the Access key ID and the Secret access key – we will need them later
The next step is to configure your AWS credentials on your local machine
- Create a new folder under /Users/your-user/.aws
- Create a file named credentials
- The content of the file looks like (fill in the previously generated keys):
aws_access_key_id = your-access-key-id
aws_secret_access_key = your-secret-access-key
If you finished that step, you can install ClaudiaJS
- Choose a folder where you want to create your new NodeJS application
- Open up a command prompt in that folder
- Type npm init
- Type npm install claudia -g
- Create a new file like server.js
exports.handler = function (event, context)
- Type claudia create –region us-east-1 –handler server.handler
- The handler, is the name of your file where is the entrypoint of your application. Like server.js or app.js.
- This will create a new lambda function and upload your content
- You can test if the creation succeeded by typing: claudia test-lambda
- For updates, you can simply use: claudia update
To use the new handler with Alexa Skills, you must select Alexa Skills Kit as trigger in the AWS lambda web console.
ClaudiaJS supports more tasks like defining tests or checking the logs. You can find the full documentation at https://claudiajs.com/documentation.html