Home > Alexa > Alexa Skills Kit

Deploying a Web Service for a Custom Skill to AWS Elastic Beanstalk

Introduction

Introduction

The cloud-based service for an Alexa skill must be available at an Internet-accessible endpoint that supports transmitting requests over HTTPS. One option for such an endpoint is AWS Elastic Beanstalk, a service offering by Amazon Web Services.

Elastic Beanstalk Deployment Work Flow

The basic Elastic Beanstalk work flow is as follows:

  1. Create your web service and build an application source bundle (such as a Java .war file).
  2. Upload your source bundle to AWS Elastic Beanstalk as a new application version.
  3. Configure the application in Elastic Beanstalk as needed.

Elastic Beanstalk automatically launches an environment and creates and configures the AWS resources needed to run your code. After your environment is launched, you can then manage your environment and deploy new versions as needed.

For details about Elastic Beanstalk, see the Elastic Beanstalk documentation.

For a detailed example illustrating how you can use Elastic Beanstalk to deploy and test the provided Alexa samples, see Deploying a Sample Custom Skill as a Web Service.

Requirements for Using Elastic Beanstalk

Hosting your web service on Elastic Beanstalk requires the following actions:

  • Create an AWS Identity and Access Management (IAM) account and grant it full access to Elastic Beanstalk.
  • Upload your web service to an Elastic Beanstalk environment as a source bundle, such as a Java .war file.
  • Elastic Beanstalk does not provide wildcard certificates, so you need to provide a valid SSL certificate to test your Alexa skill:
    • For testing, you can create a self-signed certificate. Make sure the domain name of your Elastic Beanstalk environment is correctly specified in the certificate (for details about creating a certificate, see Testing a Custom Skill).
    • Use the AWS Command Line Interface to upload the certificate as a server certificate.
    • In your Elastic Beanstalk environment, configure the Load Balancing options to use port 443, HTTPS, and your SSL Certificate.
  • Update your configuration on the developer portal with the correct endpoint for the Elastic Beanstalk environment.

Setting Java System Properties for Elastic Beanstalk

When using the Java library, you need to set some options using system properties. This lets you set these options at runtime rather than hard-coding these options. You can set the following system properties:

  • com.amazon.speech.speechlet.servlet.timestampTolerance: Defines the tolerance, in seconds, to allow when verifying the timestamp on a request. For details about how this is used, see the “Checking the Timestamp of the Request” section in Hosting a Custom Skill as a Web Service.
  • com.amazon.speech.speechlet.servlet.supportedApplicationIds: Defines a comma-separated list of application IDs supported by your service. For details about how this is used, see the “Verifying that the Request is Intended for Your Skill” section in Handling Requests Sent by Alexa.

You can configure these properties in the Elastic Beanstalk console:

  1. Log in to the AWS Management Console. Navigate to Elastic Beanstalk and then navigate to your new environment.
  2. In the left menu, click Configuration, then open the Software Configuration section.
  3. Under Environment Properties, scroll to the bottom of the list and find the blank rows after any existing properties.
  4. In a blank row, enter the following:
    • Property Name: Enter the fully-qualified name of the property (for example, com.amazon.speech.speechlet.servlet.timestampTolerance or com.amazon.speech.speechlet.servlet.supportedApplicationIds).
    • Property Value: Enter the value you want for the property.
  5. Click the plus button to add the new property.
  6. Click Apply to save the changes and update your environment.

For more details about custom properties in Elastic Beanstalk, see Using Custom Environment Properties with Elastic Beanstalk.

Next Steps

Next:

Return to the overall steps to build a custom skill