Do you develop in Amazon Web Services (AWS), have an Echo, and want the latest service availability details without having to open your laptop and scroll through dozens of green checkmarks? A home-schooled student named Kira Hammond has the solution with her newly-released CloudStatus Alexa skill.
CloudStatus summarizes the info on the AWS Service Health Dashboard, both current issues and recent problems. On a challenging day, Alexa’s conversation might start out like this:
“Hello! 3 out of 11 AWS regions are experiencing service issues—Mumbai (ap-south-1), Tokyo (ap-northeast-1), Ireland (eu-west-1). 1 out of 11 AWS regions was having problems, but the issues have been resolved—Northern Virginia (us-east-1). The remaining 7 regions are operating normally. All 7 global services are operating normally. Which Amazon Web Services region would you like to check?”
Interested? Listen to a recording of an example session or try it for yourself, say, “Alexa, enable the CloudStatus skill.”
Why this particular skill
Kira wrote CloudStatus with AWS Lambda, using Amazon EC2 to build Python modules for Requests and LXML. The modules download and parse the AWS status page to provide the desired data. The Python packages and the skill’s code files are zipped and uploaded to AWS Lambda.
Kira created this skill because her father, Eric Hammond, an AWS Community Hero and Internet startup technologist, wanted a simpler, easier way to access the service availability info himself. He figured having Kira create the skill would enable her to learn about retrieving and parsing web pages in Python—and being a good parent, he wanted to foster her creativity. And Kira is very enthusiastic about the creative process of development. “Programming is so much fun and so rewarding! I enjoy making tools so I can be lazy. Coding can be challenging (even frustrating) and it can be tempting to give up on a debug issue. But, oh, the thrill that comes after solving a difficult coding problem!”
And CloudStatus wasn’t Kira’s first skill. She’d already created several others—one of which was based on the AWS Lambda blueprint named alexa-skills-kit-color-expert-python and another based on the ASK Reindeer Games template. “Creating that skill was a lot of fun and helped me to grow in my knowledge of how Alexa works behind the scenes.”
Kira doesn’t have formal training in programming. Nevertheless, she was able to do most everything on her own. If she was stumped about something, Eric showed her where to find her own answers. “I pointed her at resources and recommended things to explore. I helped her sometimes when she ran into problems, but she solved most of them herself with Google and Stack Overflow.” When Kira was finished with her skill, Eric published it using his developer account.
What she learned
At first, Kira edited the code directly in the Lambda console. Soon she needed to import modules that weren't built in to Python. To manage that, she kept her code and modules in the same directory on a personal computer. That directory would get zipped and uploaded to Lambda, and the modules were right there next to the code.
Throughout the process, she grew tired of constantly opening and modifying the code, zipping it and the modules, uploading it all to Lambda, and waiting for the Lambda function to save. To resolve that, she wrote a separate Bash program that lets her type “edit-cloudstatus” into the shell. The program opens the code files in the Atom editor. After that, it calls the command “fileschanged” to automatically test and zip all the code every time she makes a change or adds a Python module.
The Alexa speech-to-text conversions sometimes surprised Kira, but a tip from Eric helped her with the solution. “For example, if I say ‘Northern Virginia,’ the Alexa Skills Kit sends ‘northern Virginia’ (lowercase then capitalized) to my skill, whereas ‘Northern California’ turns into ‘northern california’ (all lowercase). To fix the capitalization inconsistencies, my dad suggested lowercasing the input and mapping it to the standardized AWS region code as soon as possible.”
As with many beginning developers, Kira’s biggest challenge is avoiding the impulse to try to do it perfectly the first time. “Practically every time I upload my code for testing, there’s an error.” But as she’s discovering, “Isn’t that what testing is for? When I modify everything at once instead of making improvements bit by bit, the bugs are more difficult to sort out. I'm slowly learning from my dad to make small changes and update often.”
Kira’s tips for new Alexa developers
- Take advantage of the ASK blueprints and templates, which include lots of helpful comments.
- The first time you open a blueprint, you might not know what you’re looking at. Before modifying your code, ask Alexa to run the skill. Everything she says from that point on is somewhere in your program! Find her response in the program and tweak it. The variable name is something like “speech_output” or “speechOutput.”
- Use some built-in Amazon intents, such as AMAZON.YesIntent or AMAZON.HelpIntent.
- Before submitting your skill for certification, be sure to read through the submission checklist.
- Review your skill’s home cards often, and note that sometimes the text that Alexa pronounces should be different from the reader-friendly card content. For example, in CloudStatus, “N. Virginia (us-east-1)” might be easy to read, but Alexa is likely to pronounce it “En Virginia, Us [as in we] East 1.”
- If you don’t want a card to accompany a specific response, remove the ‘card’ item from your response dict. Look for the function build_speechlet_response() or buildSpeechletResponse().
- For those using AWS Lambda, never point your live/public skill at the $LATEST version of your code. Instead, publish a version of your working Lambda function, then make an alias that points to the frozen version. The $LATEST version is for editing and testing only, so you don’t break the live skill.
- Refer to the ASK best practices for tips on designing voice interactions.
Kira looks forward to making enhancements to CloudStatus. “I don’t think it’s possible to finish a program for good! There’s always something to add or learn about—right now it’s Speech Synthesis Markup Language (SSML).” She may even explore expanding the skill to other clouds. In August a new ASK template was released for decision tree skills, and she’d like to make some sort of dichotomous key with that. She’s also interested in learning more about controlling her family’s house lights and thermostat with Alexa. “I could make the lights flash and turn different colors, which would be super fun.”
Whatever skills she creates, Kira appreciates not having to build her own language model. “With text-based programs, I spend a considerable amount of time listing all the ways a person can answer ‘Yes’ or request help. With Alexa I don’t have to worry about how the user will phrase their sentences. Amazon already has an algorithm, and it’s constantly getting smarter!”
Share other innovative ways you’re using Alexa in your life. Tweet us @alexadevs with hashtag #AlexaDevStory.
Get Started with Alexa Skills Kit
Are you ready to build your first (or next) Alexa skill? Build a custom skill or use one of our easy tutorials to get started quickly.