Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

使用 AWS 無伺服器運算服務打造您的第一個語音助理


Published on

無伺服器運算可讓您無需佈建或管理伺服器,即可建置及執行應用。您可透過無伺服器運算建置網頁、行動及物聯網後端、執行串流處理或大數據工作負載、運作聊天機器人,以及執行 Amazon Alexa 應用程式及其他。在本場專題演講中,您將了解如何上手使用 AWS Lambda 進行無伺服器運算,以便在不佈建或管理伺服器的前提下執行程式碼。另外也將介紹使用 Lambda 進行佈建作業的基礎知識,以及無伺服器功能對您的效益。本場專題演講還會解說如何運用 AWS Lambda 功能自訂 Alexa 的技巧知識。

Published in: Technology
  • Login to see the comments

使用 AWS 無伺服器運算服務打造您的第一個語音助理

  1. 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Simon Wang Technical Account Manager, AWS Enterprise Support June 7th, 2017 How to Use AWS Serverless Computing to Develop Your First Voice Assistant
  2. 2. Agenda • Why AWS Lambda? • How Lambda works • Hello, Amazon Alexa • Demo
  3. 3. Why AWS Lambda?
  4. 4. Servers How will the application handle server hardware failure? How can I control access from my servers? When should I decide to scale out my servers? When should I decide to scale up my servers? What size servers are right for my budget? How much remaining capacity do my servers have? (AAHHHHHHHHH!!)
  5. 5. Operations and management Scaling Provisioning and utilization Availability and fault tolerance Owning servers means dealing with ...
  6. 6. Key Differences Between Compute Offerings VM Task Function Service EC2 ECS Lambda H/W OS Runtime Unit of scale Level of abstraction
  7. 7. How Lambda works
  8. 8. AWS Lambda: Run code in response to events FUNCTION SERVICES (ANYTHING) Changes in data state Requests to endpoints Changes in resource state Node Python Java C# EVENT SOURCE
  9. 9. Amazon S3 Amazon DynamoDB Amazon Kinesis AWS CloudFormation AWS CloudTrail Amazon CloudWatch Amazon Cognito Amazon SNSAmazon SES Cron events DATA STORES ENDPOINTS CONFIGURATION REPOSITORIES EVENT/MESSAGE SERVICES Example event sources that trigger AWS Lambda … and a few more with more on the way! AWS CodeCommit Amazon API Gateway Amazon Alexa AWS IoT AWS Step Functions
  10. 10. Using AWS Lambda Bring your own code • Node.js, Java, Python, C# • Bring your own libraries Simple resource model • Select power rating from 128 MB to 1.5 GB • CPU and network allocated proportionately Flexible use • Synchronous or asynchronous • Integrated with other AWS services Programming model • Use processes, threads, /tmp, sockets normally • AWS SDK built in (Python and Node.js)
  11. 11. Automatic Scaling • Each event is a Lambda request • Lambda scales to match the event rate • Don’t worry about over or under provisioning • Pay only for what you use
  12. 12. Common Use Cases Web Applications • Static websites • Complex web apps • Packages for Flask and Express Data Processing • Real time • MapReduce • Batch Chatbots • Powering Chatbot logic Backends • Apps & services • Mobile • IoT </></> Amazon Alexa • Powering voice-enabled apps • Alexa Skills Kit IT Automation • Policy engines • Extending AWS services • Infrastructure management
  13. 13. Hello, Amazon Alexa
  14. 14. What Can Alexa Do?
  15. 15. Alexa App and Skills
  16. 16. Introduce to Alexa Platform
  17. 17. Demo Ask Alexa the Weather in Any City in Taiwan
  18. 18. How to Achieve It?
  19. 19. Technologies We Used • Node.js and JavaScript • AWS Lambda • Amazon Alexa service and Alexa Skills Kit (
  20. 20. How to Create an AWS Lambda Function
  21. 21. Code Snippet - weather.js Publish this function for fetching weather data Invoke external WebService Return weather info in TEXT
  22. 22. Code Snippet - lamdba.js Include Alexa Skills Kit Include weather.js module Initial an Alexa handler and register all handlers Open Skill Stop Skill About weather Recipe for pork Say a joke
  23. 23. Code Snippet - lamdba.js – Cont. Launch Skill function Weather Intent function Retrieve Slots (City Name) Get weather information by City Name Speak out (emit) weather information
  24. 24. Packing Node.js Function #For MacOS zip -r -q dist/ ./ -x "FILE_OR_DIR_1" "FILE_OR_DIR_2" AWS-SDK can be excluded!!
  25. 25. How to Integrate Alexa Skill with Lambda
  26. 26. Amazon Developer Console (Portal)
  27. 27. Slot (City Name)
  28. 28. Demo Updating Lambda Function
  29. 29. No servers to provision or manage Scales with usage Never pay for idle Availability and fault tolerance built in Benefits of Lambda and Serverless Compute
  30. 30. AWS Lambda Pricing • Charged by • Request count ($0.2 per 1m requests) • Compute ($0.00001667 per GB*second) • Buy compute time in 100 ms increments • No minimums fees • No per-device fees Free Tier 1 million requests and 400,000 GB*second of compute every month, every customer Example • 256MB of memory • Executed 3 million times per month • It ran for 1 second each time Around $6.2 per month!
  31. 31. Takeaways • Serverless doesn’t actually mean that we have no servers. It means that you don’t need to deal with them anymore and focus on your business logic • Many use cases can go Serverless computing • Web, data processing, interactive backends, Chatbots, Alexa, auto managing AWS resources • Bots development on AWS is easy and agile • Serverless ecosystem continues to grow • Tooling, languages, and application capabilities
  32. 32. Thank you!
  33. 33. Next steps 1. Go to and create your first Lambda function 2. Stay up to date with AWS Lambda on the Compute blog and check out for scenarios and customer stories. 3. See for reference architectures, samples, and links to more content. 4. Send us your questions, comments, and feedback on the AWS Lambda Forums.