Why Learning to Code Alexa Skills is the Gateway to a Cloud Computing Job

The nature of work is undergoing an economic transformation. We are in the midst of a shift from a commodity-based economy powered by physical capital and manual labor to one based on intellectual capital and driven by technology. The jobs of tomorrow will increasingly involve building the digital machinery that powers the information economy.

Nowhere is this more evident than in the meteoric rise of cloud computing. Global spending on public cloud services is forecasted to grow from $122.5 billion in 2017 to over $203 billion by 2020, an annual growth rate of over 30%. The areas of cloud infrastructure-as-a-service (IaaS) and software-as-a-service (SaaS) are expected to see the highest growth as companies pursue digital transformation initiatives.

However, this rapid expansion of the cloud is creating an acute shortage of qualified talent. A lack of cloud computing skills is now cited as the number one challenge impeding cloud adoption by companies. As a result, cloud fluency has become one of the most in-demand and highly compensated skill sets in the IT industry. In 2016, the top paying IT certification was for Amazon Web Services, commanding an average salary of $125,871.

So how can aspiring technologists take advantage of the incredible career opportunities in cloud computing? One of the most accessible entry points is by learning to develop Alexa skills.

The Shift to Serverless Cloud Computing

Just as the broader economy is shifting from physical commodities to intellectual capital, a similar transition is taking place in how cloud services are delivered and consumed. The first wave of cloud adoption focused on migrating existing applications to remote data centers and running them on rented servers and virtual machines.

However, a new model has emerged called serverless computing or Functions-as-a-Service (FaaS). With a serverless approach, developers can build and run applications without having to manage any underlying infrastructure. Instead of provisioning and maintaining servers, the cloud provider dynamically allocates compute execution power only when needed to handle specific events or requests. Code is deployed as individual functions that are only triggered on-demand.

The poster child for serverless computing is AWS Lambda, a service that lets you run code without provisioning or managing servers. With Lambda, you can upload your code as individual functions and AWS will take care of everything required to run and scale your code with high availability. You only pay for the compute time your code actually consumes.

Building Alexa Skills with AWS Lambda

One of the most engaging ways to gain hands-on experience with serverless computing is by developing custom skills for Amazon‘s wildly popular Alexa voice assistant platform. Alexa skills are essentially apps that extend the capabilities of Alexa-enabled devices like the Amazon Echo.

Since Amazon opened up Alexa to third-party developers, over 10,000 skills have been created. And the vast majority are powered on the backend by Lambda functions. The Alexa Skills Kit is tightly integrated with AWS Lambda, allowing developers to build skills in Node.js, Python, C#, or Java, some of the most ubiquitous programming languages.

Here‘s a high-level overview of the architecture for a typical Alexa skill:

  1. A user interacts with an Alexa-enabled device by voice command
  2. The Alexa service translates the speech to text and sends a structured request to the skill
  3. The request triggers the invocation of the corresponding Lambda function
  4. The Lambda function processes the request and returns a response
  5. Alexa translates the response text to speech and reads it back to the user

To demonstrate just how quick and easy it is to get started, let‘s walk through a simple "Hello World" example of building an Alexa skill.

Prerequisites

Before you begin, you‘ll need an Amazon Developer account and an AWS account. Both are free to create.

You‘ll also want to make sure you have Node.js installed, as that is the language we‘ll use for this example. But you can follow along with Python, Java, or C# as well.

Step 1: Create the Skill

Log in to the Alexa Skills Kit Developer Console and click the "Create Skill" button. Give your skill a name like "Greeter" and choose "Hello World Skill" as the model to add to your skill. Select the "Provision your own" option for the backend resources and choose "Lambda function" for the endpoint.

Click "Create skill" and you‘ll be directed to the skill builder checklist.

Step 2: Create the Lambda Function

Now switch over to the AWS Management Console and navigate to the Lambda service. Click "Create function" and choose "Author from scratch." Give your function a name like "alexa-greeter-skill" and select "Node.js 6.10" for the runtime.

For the role, choose "Create new role from template(s)" and give it a name like "alexa-greeter-skill-role". Under Policy templates, search for and select "Simple Microservice permissions." This will grant the necessary permissions for your function to execute and write logs.

Click "Create function" and you‘ll be taken to the function configuration page. Replace the sample code in the inline editor with the following:

exports.handler = (event, context, callback) => {

    var speechOutput = "Hello there!";
    var cardTitle = "Greeter";

    callback(null, {
        version: "1.0",
        response: {
            outputSpeech: {
                type: "PlainText",
                text: speechOutput  
            },
            card: {
              type: "Simple",
              title: cardTitle,
              content: speechOutput
            },
            shouldEndSession: true
        }
    });
};

This is a very basic Lambda function that will simply greet the user by returning "Hello there!" as the speech and card output.

Click "Save" at the top of the page. Then copy the ARN string at the top right, which uniquely identifies this function. It should look something like: arn:aws:lambda:us-east-1:123456789012:function:alexa-greeter-skill

Step 3: Link the Skill and Lambda Function

Navigate back to the Alexa skill builder checklist. Under "2. Interaction Model" in the left sidebar, select "JSON Editor."

Copy and paste the following JSON into the code editor:

{
    "interactionModel": {
        "languageModel": {
            "invocationName": "greeter",
            "intents": [
                {
                    "name": "AMAZON.CancelIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.HelpIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.StopIntent",
                    "samples": []
                },
                {
                    "name": "HelloWorldIntent",
                    "slots": [],
                    "samples": [
                        "hello",
                        "say hello",
                        "say hello world"
                    ]
                },
                {
                    "name": "AMAZON.NavigateHomeIntent",
                    "samples": []
                }
            ]
        }
    }
}

This defines the interaction model for the skill, including the invocation name "greeter" which is used to activate the skill, and a custom "HelloWorldIntent" with sample utterances that will trigger our Lambda function.

Click "Save Model" and then "Build Model" to apply the changes.

Under "3. Configuration" in the sidebar, select "Endpoint." Paste the Lambda function ARN you copied in the previous step under "Default Region."

Click "Save Endpoints."

Step 4: Test the Skill

Under "4. Test," switch the skill testing toggle from "Off" to "Development."

In the Alexa Simulator tab, type "open greeter" into the text input and hit enter. You should get a text and voice response back saying "Hello there!"

And with that, you‘ve successfully built, deployed and tested your first Alexa skill using AWS Lambda. You‘re well on your way to becoming a cloud-native Alexa developer!

Taking Your Alexa Skills to the Next Level

This basic example only scratches the surface of what‘s possible with Alexa skill development. As you advance your skills, you can take advantage of many more features such as:

  • Customized multi-turn dialogs with context carryover
  • Dynamic content powered by web services and APIs
  • Storing data with Amazon DynamoDB and S3
  • Audio and video streaming
  • Smart home device integration
  • Voice purchasing through Amazon Pay

Some interesting examples of more complex Alexa skills include:

  • Domino‘s allows you to order pizza for delivery or pick-up
  • Uber lets you request a ride and get status updates on your driver
  • Capital One enables you to check your account balance, pay bills and track spending
  • Fitbit gives you insights and progress updates on your daily activity goals
  • Big Sky provides hyper-local weather forecasts based on your street address

Amazon provides a wealth of resources to help developers level up their Alexa skills. The Alexa Skill-Building Cookbook on GitHub is an excellent collection of more advanced code samples covering topics like state management, dialog delegation, entity resolution, and connecting to REST APIs.

There are also official courses and tutorials in the Alexa Skills Kit curriculum to guide you through the development process. And the Alexa developer blog and forums are great places to stay up to date on the latest news and interact with the Alexa community.

As added incentive to dive into skill building, Amazon has been known to give away free swag like t-shirts and Echo Dots to developers who publish skills. They also have a rewards program where you can earn cash for building high-quality game, trivia and educational skills.

Get Started Building Your Cloud Computing Future

As the shift to cloud computing accelerates and demand for skilled practitioners continues to outpace supply, there has never been a better time to launch a career in cloud technology. And building Alexa skills is an accessible on-ramp to gain practical experience with key cloud services like serverless functions, cloud APIs, NoSQL databases, and more.

Beyond just resume-building, creating Alexa skills is incredibly rewarding in its own right. With a few lines of code, you can build an intelligent interface that makes life a little easier, enables a novel way to consume a service, or entertains and delights end users. You might even build the next killer voice app and monetize it through the Alexa Developer Rewards program!

So what are you waiting for? Dive in and start bringing your Alexa skill ideas to life. Before long, you‘ll be on the path to becoming an in-demand cloud computing professional. The sky‘s the limit!

Similar Posts