3

Pick Your Hosting Platform Carefully

When designing an Alexa Skill, before you write a single line of code, you need to consider where you want your skill to live and run. In this chapter, I will cover the options and potential benefits of different environments for your skill.

When picking a hosting environment, at a minimum you need to consider the following factors:

  1. Languages
  2. Costs Maintenance Administration

Are you part of a large company that manages their own internet presence, or maybe you’re a smaller team or even lone-wolf developer? Do you work primarily in a Microsoft shop (Windows, IIS/ASP.NET, SQL Server, C#/VB.NET) or do you prefer the open source LAMP (Linux, Apache, MySQL, Python) stack? Do you have a dedicated IT staff, or are you expected to handle everything yourself?

There are essentially three broad options for hosting environments, so I’ll talk about each of them and drill into the benefits of each.


Cloud

A proper discussion of cloud computing could easily fill an entire book, but for our purposes it comes down to three offerings: Amazon Web Services, Microsoft Azure & Google Cloud. Depending on your requirements, any of these would be suitable environments, so I’ll break down the differences and mention any pros/cons of each.

Amazon Web Services (AWS)

AWS offers serverless computing via AWS Lambda Functions. This means you can build and execute your code without having to worry about server configuration or management.

  1. Languages: C# (.NET Core), Java, Node.js, Python
  2. Pay only for compute time. Potentially Free.
  3. Serverless means not having to deal with server maintenance or configuration
  4. You can set permissions and roles for your skills via the AWS Dashboard

When used for Alexa Skills, AWS is free for the first million AWS Lambda requests & 750 hours of compute time per month. If you exceed these limits, you “may incur AWS usage charges.”

You can also apply for an additional $200 per month in promotional credits for Alexa Skills here: http://amzn.to/2mNJPsf.

If you’re already familiar with one of the supported languages, not reliant on any Microsoft specific technologies, and like the price tag (FREE!) then AWS is a terrific option for skills development.


Microsoft Azure

If you’re primarily a Microsoft shop, and don’t want the overhead of setting up and managing your own servers, Azure offers a nice integrated pipeline for publishing your skill’s backend service directly from Visual Studio.

Azure Web Apps is a serverless option (much like AWS Lambda) that scales on demand and does not require any server maintenance or configuration.

  1. Languages: ASP.NET (C#), Node.js, PHP, Python
  2. Free initially*
  3. Serverless means not having to deal with server maintenance or configuration
  4. In addition to serverless, Azure offers full virtual machines in your choice of OS.

*Azure offers a free account that comes with a $200 credit to spend for 30 days, and certain products are free for 12 months. This covers up to a million requests and 400 TB of “resource consumption.” The Azure Free Account FAQ (located here: http://bit.ly/2wnXSHa) shows the most current “free” plan features, and breaks it down pretty well.

If you need support for Microsoft specific products like Active Directory, SQL Server, etc. then Azure may be your only Cloud option for Alexa Skills. I’ll walk you through creating an Azure based Alexa Skill in Chapter 6.


Google Cloud

If JavaScript is your preferred language, and you want easy integrations with Google’s various product APIs, then Google Cloud may be the platform for you.

  1. Languages: Node.js
  2. Costs: Free initially*
  3. Serverless means not having to deal with server maintenance or configuration
  4. Handled via Cloud Console Web Admin UI

*Google Cloud offers a 12 month free trial that includes $300 in free credit and access to all Google Cloud products, such as the Google Maps API. This covers two million invocations (requests) and 400 TB of compute time per month. Each additional million invocations (per month) is $0.40, so even if your skill is incredibly popular, your monthly charges won’t be terribly high unless you’re pushing a lot of outbound data (which caps at 5GB per month, with a $0.12 per GB charge after that.)

Google Cloud also offers excellent support for microservices and mobile app integration with their Cloud Functions product.

I won’t be specifically covering Google Cloud in this book, but your Node.js based projects should run without any manual conversion necessary. Just make sure to select the HTTPS Service Endpoint Type when providing the address of your skill on the Configuration tab of the ASK Dashboard, as shown in Figure 3-1, below.



Figure 3-1: Configuration Tab of the Alexa Dashboard


As you can see, all three of the big Cloud providers offer a serverless computing option, and all three offer some form of free plan, for at least a year. There really are no wrong choices here. The one you pick depends on which of these providers meets your needs.

Having said that, Amazon has a vested interest in putting (and keeping) your skills in AWS, and regularly offers incentives to Alexa Skills developers.

The next category I’ll cover is Leased Web Hosting, which is the more traditional, typically “flat rate + extras” hosting option.


Leased Web Hosting

Leased web hosting is available in nearly every price and configuration imaginable. Prior to the Cloud, this or self-hosting were your only options. For most small teams (or lone developers), self-hosting isn’t really an option.

Because there are so many hosting options, there’s a lot of flexibility here. You can use any language (even Ruby on Rails) capable of returning a properly formatted JSON message to a request, so the choice of host is entirely based on what language you wish to use and how much you wish to pay (which can vary widely.)

Depending on your host, server configuration and administration may play a bigger role compared to the serverless cloud options listed above. Also, the cheaper web hosts use shared hosting which means you will be competing for bandwidth and processing power with any other services or websites also being hosted on your server. Dedicated server hosting is available, of course, but the monthly price may exceed what you would pay for Cloud hosting.

Generally speaking, the cheaper the host, the more websites and services you’ll be competing with for resources, which can directly impact performance. Hosting companies bet heavily on low traffic for websites, and it’s not unheard of to have 20 or more websites hosted on a single machine. You’re also at their mercy for any special configuration tasks, backup/restore tasks, and some options may simply be unavailable.

Many leased web hosts offer a menu of “extra” services for additional fees. By the time you add a database instance, secure certificate for https support, domain name registration, additional bandwidth, additional storage, etc. you may find that Cloud hosting is a cheaper alternative.

  1. Languages: All
  2. Costs: Varies
  3. Varies
  4. Varies

While there are certainly some free hosts available, they have little or no guarantee of uptime/availability, offer minimal access to configuration options, and most do not support anything beyond simple websites (no services).

You may be thinking that I’m pushing you towards the Cloud, and you’re right. There’s no question that there are some excellent Web Hosts available, but for ease of use, price, and reliability, cloud computing is really the way to go.

The bottom line here is, if you’re going to used Leased Web Hosting, be sure to get a good one. If your skill is occasionally unavailable or performs poorly it can fail the Alexa Skill certification process or get de-listed if it fails to respond too often.

In the next section, I’ll look at self-hosting options, and discuss the pros and cons associated with going that route.


Self-Hosting

In this context, self-hosting implies complete control over the software, hardware and internet connection responsible for your online presence. This typically involves a pretty substantial investment in hardware, software and staff to maintain it.

  1. Languages: All
  2. Costs: Varies
  3. Varies
  4. Varies

Much like leased hosting, self-hosting can come in literally in any flavor you want, because you’re doing it yourself. The only limits are what you can afford, and the knowledge of your development and support teams.

SIDE NOTE: If you’re a solo dev, you may be thinking “Hey! I’ve got a blazing fast internet connection, and I can get a fixed IP address for $10 extra per month. I could totally host this on my home computer!” If you’re thinking this, please stop. The average desktop machine isn’t really suitable for running as a server on the internet, and your service will go down every time your machine gets overloaded, or any time you reboot.

If done properly, this is absolutely the most expensive option you could pick. Self-hosting costs can easily run into the tens of thousands of dollars per month, by the time you factor in hardware, server licenses, dedicated internet, IT staff, power, etc. If done poorly, self-hosting could be disastrous.

Of course, if you are developing Alexa Skills on behalf of a company that self-hosts already, go for it. There’s little or no expense beyond the investment of your time.


That’s it for this chapter. While I’ve broken down the pros and cons of each, all of these options are feasible, depending on your situation. In Part II, We’ll start digging deeper into Custom Skills, designing a City Facts skill in Chapter 4, and then building AWS Lambda and Azure Service versions in Chapters 5 and 6, respectively.