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

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.

Note: All calls from the Alexa service come from the US East (N. Virginia) AWS region. Therefore, for best performance and reduced cost, create your Elastic Beanstalk environment in the US East (N. Virginia) region.

Elastic Beanstalk Deployment Work Flow

Create your web service and build an application source bundle (such as a Java .war file).

Upload your source bundle to AWS Elastic Beanstalk as a new application version.

Configure the application in Elastic Beanstalk as needed.

Note: If you write your web service in Java, you can use the AWS Toolkit for Eclipse to do all of these steps within Eclipse.

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.

Update your configuration on the developer console 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:

Log in to the AWS Management Console. Navigate to Elastic Beanstalk and then navigate to your new environment.

In the left menu, click Configuration, then open the Software Configuration section.

Under Environment Properties, scroll to the bottom of the list and find the blank rows after any existing properties.

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).