Serverless. It’s all the rage. And one of our awesome engineers, Joshua Cornutt, wanted to see how we could apply it to Cloudify. From that initial thought came inspiration – voice control.
Amazon already has the ability to create new Alexa skills, and, with Lambda, it’s pretty simple to build a basic application. So, he did just that.
Prerequisite reading material
First, some information to help you out in case you’re not familiar with the process of creating an Alexa Skill or have never used AWS Lambda before:
Here is the Github repository Josh put together to create an Alexa Skill that interacts with a Cloudify Manager, as well as the Lambda application. It’s meant to be an example for others to build Alexa Skills and, as Josh puts it, “it’s just a neat app for Cloudify users.”
The basic process to getting this up and running is:
- Create the skills with the provided json files
- Build the sample Lambda app with the provided code
- And voila!
Once you have it all ready to go, just ask Alexa about Cloudify Manager with commands like:
Alexa, ask Cloudify if it’s running
Alexa, ask Cloudify what version it’s on
Alexa, ask Cloudify how many blueprints are installed
Alexa, ask Cloudify how many executions are running
See Josh’s video below:
Ready to get started? Follow the instructions below!
Using Alexa Skills schema files
The included alexa-skill-intent-schema.json and alexa-skill-sample-utterances.txt files are there for quick copy and paste into the Alexa Skills application Interaction Model area. Simple copy and paste the data from alexa-skill-intent-schema.json to Intent Schema and alexa-skill-sample-utterances.txt to Sample Utterances.
There are no Custom Slot Types in this example but feel free to add some and extend this project!
Building AWS Lambda application
- Install requirements to the lambda directory itself by executing pip install -r lambda/requirements.txt -t lambda/ assuming you’re in the project root directory.
- Change the values for VALID_APP_IDS and CFY_ENDPOINT in lambda.py to fit your needs. Note: in most cases, you should add to VALID_APP_IDS your Alexa Skills ID and leave the placeholder there since the Alexa Skills test function has an ID of (literally) amzn1.ask.skill.[unique-value-here].
- ZIP up the contents of the lambda directory (not including the directory itself).
- Create a new Lambda application using the ZIP file you just created. The function entry point will be lambda.lambda_handler.
- If you run a test, you should get back “Sorry, I did not understand the request”.
We love this project and hope that it inspires some of our users to develop more interesting skills with Alexa, so please feel free to commit some code!