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.
- Elastic Beanstalk Deployment Work Flow
- Requirements for Using Elastic Beanstalk
- Setting Java System Properties for Elastic Beanstalk
- Next Steps
Elastic Beanstalk Deployment Work Flow
The basic Elastic Beanstalk work flow is as follows:
- 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.
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.
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.
- 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 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 thetimestamp
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
orcom.amazon.speech.speechlet.servlet.supportedApplicationIds
). - Property Value: Enter the value you want for the property.
- Property Name: Enter the fully-qualified name of the property (for example,
- Click the plus button to add the new property.
- 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
Last updated: Jan 26, 2024