When planning the architecture of your custom Alexa skill, you can choose the type of service that will run the code behind the skill. You can elect to implement your own web service to accept requests from the Alexa service and send back responses to it, or you can decide to leverage an AWS Lambda function.
Many Alexa skill builders use AWS Lambda to build the backend for their custom Alexa skills. AWS Lambda is a service that runs your code in the cloud, freeing you up from having to find, provision, and manage servers. If you have wondered why Lambda is such as great match for custom skills, let me tell you four benefits of using AWS Lambda.
1. You Can Focus on Building Your Voice Experience Instead of Managing Your Computing Resources
Lambda runs your code in the cloud, and only when it’s needed. With Lambda, there is no need to continuously run servers to support your Alexa skill 24/7. Lambda also scales automatically in a high-availability infrastructure, following compute demand from the skill’s requests. All you need to do, for a custom Alexa skill, is to upload your code into a Lambda function, which will execute in response to Alexa voice interactions. Currently Lambda supports Node.js, Python, Java, and C#.
2. You Don’t Need to Provide an SSL Certificate
The Alexa service requires that all web connections be secured via SSL/TLS. To be used by a live custom skill, your HTTPS endpoint will need a valid and trusted certificate to establish a connection. Several configurations are available, depending on how you obtain this certificate.
Conversely, if you use Lambda as endpoint for your skill, you will leverage the built-in TLS secured communication between Alexa and the Lambda endpoint. There is no need to manually provide and maintain a certificate as Lambda uses invocation permissions to control access.
3. Lambda Streamlines Access Control and Security
With Lambda, the verification that the requests for the endpoint are indeed from Alexa is done via the AWS permission framework. Lambda, which is tightly integrated with AWS’ Identity and Access Management (IAM), uses role-based authentication and access control. You only need to set up the skill’s APP_ID in the Lambda function and create an AWS IAM execute role to make sure your skill can invoke the Lambda function.
4. Lambda Is Part of the AWS Free Tier
Lambda is part of the AWS Free Tier which offers one million requests per month at no charge. In most cases, the free tier is sufficient for the function supporting an Alexa skill. In addition to the free tier, you can also apply for AWS promotional credits. If you have a published Alexa skill, you can apply to receive a $100 AWS promotional credit. You can also receive an additional $100 per month in AWS promotional credits if you incur AWS usage charges for your skill, making it free to build and host most Alexa skills.
Lambda: The Fast Way to Build an Alexa Skill
If you want to focus on designing and building your best Alexa skill (and not have to worry about managing your backend), Lambda is a great choice. Start building today with Lambda and the Alexa Skills Kit. You can also check out the Alexa repositories on GitHub. We can’t wait to see what you build.
Build a Skill, Earn Developer Perks
Got skills? Bring your big idea to life with the Alexa Skills Kit and earn perks through our new tiered rewards system. Publish a skill in October, and earn a limited-edition Alexa dev shirt. If 100 unique customers use your skill in its first 30 days in the Alexa Skills Store, you can also apply to receive a free Echo Dot. Learn more about our promotion and start building today.
Source: Alexa Developer Blog