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.
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Yi-an Han,
Senior Business Development Manager
D...
What to Expect from the Session
進到無伺服器時代
AWS Step Functions
為什麼我需要使用AWS Step Functions?
AWS Step Functions可以幫我做什麼事?
Live D...
進到無伺服器時代
region
Availability Zone A
Web Tier Application Tier Master DB
Standby DB
Availability Zone B
Web Tier Application Tier
Tr...
region
Static
Content
Dynamic
Content
API Gateway Lambda DynamoDB
S3
Serverless Website
而價格呢?
The serverless compute manifesto
Functions are the unit of deployment and scaling.
No machines, VMs, or containers visible...
Bustle.com
• 52 million monthly users
• 100 million events daily
Amazon
API Gateway
AWS Lambda Amazon Kinesis AWS Lambda
Redis
Amazon Mobile
Analytics
Amazon CloudWatch
Amazon Elasticsear...
Bustle.com
• 52 million monthly users
• 100 million events daily
• 84% cost savings
• 0 servers
• 0 operating system patch...
λλ
λ DBMS
λ
λ
λ
λ
λ
λ λ
λ
λ
Queue
Modern
Serverless
app
Modern
Serverless
app
“I want to sequence functions”
“I want to select functions based on data”
“I want to retry functions”
“I want try/catch/fi...
Twelve-factor processes are stateless and share-nothing. Any data that needs to
persist must be stored in a stateful backi...
Coordination by method call
λ λ
λ
λ
λ
λ
λ
Coordination by function chaining
λ
λ
λ
λ
λλ
λ
Coordination by database
λλ
λ
λ
λλ
λ
Coordination by queues
λ
λ
λ
λ λλ
λ
Coordination must-haves
• Scales out
• Doesn’t lose state
• Deals with errors/timeouts
• Easy to build & operate
• Auditab...
AWS Step Functions
生產力:迅速建立應用程式
AWS Step Functions 包含視覺化主控台與
常用工作流程的藍圖,讓您將分散式應用
程式的元件協調成平行和/或連續步驟的工
作變得更加容易。您可以在幾分鐘內建立
應用程...
Define in JSON
{
"Comment": "An Amazon States Language example using a Choice
state.",
"StartAt": "FirstState",
"States": ...
視覺化方式將您的應用程式定義成一系列步驟
以視覺化方式將您的應用程式工作流程定義成一系列步驟。視覺化主控台會以執行順序自動顯
示每一步驟的圖片,讓設計多步驟應用程式的複雜工作流程變得更加輕鬆。下表提供的範例,
是一個相片分享應用程式的步驟流程,...
視覺化方式確認一切如預期運作
主控台會用不同顏色顯示每個步驟的即時狀態,並提供每個執行的詳細歷史記錄。
運作的細節監看與稽核
為什麼我需要使用
AWS Step Functions?
AWS Step Functions
可以幫我做什麼事?
“I want to sequence functions”
AWS Step Functions, we can easily change and iterate on
the application workflow of our foo...
“I want to select functions based on data”
With AWS Step Functions, it was easy to build a multi-step product
updating sys...
“I want to retry functions”
We get transient errors from a RESTful
service we depend on, once every four
or five times we ...
{
"Comment": "Call out to a RESTful service",
"StartAt": "Call out",
"States": {
"Call out": {
"Type": "Task",
"Resource":...
“I want to run functions in parallel”
We want to send the captured image to
three OCR providers and take the result
with t...
“I want try/catch/finally”
AWS Step Functions makes it simple to coordinate information
from many different infrastructure...
13 AWS Lambda Task States
6 Choice States
1 Fail State
“I want try/catch/finally”
"Access Media": {
"Type": "Task",
"Resource": "arn:aws:lambda:eu-central-
1:123456789012:function:FindMedia",
"TimeoutSeco...
“I have code that runs for hours”
We need to gather data from our
production line, in units of 8-hour shifts.
“
"NextShift": {
"Type": "Wait",
"TimestampPath": "$.ShiftStart",
"Next": "Gather Plant Data"
},
"Gather Plant Data": {
"Typ...
“I want to sequence functions”
“I want to select functions based on data”
“I want to retry functions”
“I want try/catch/fi...
Live Demo
Thank you!
yianhan@amazon.com
Remember to complete
your evaluations!
使用 AWS Step Functions 開發 Serverless 服務
使用 AWS Step Functions 開發 Serverless 服務
使用 AWS Step Functions 開發 Serverless 服務
使用 AWS Step Functions 開發 Serverless 服務
Upcoming SlideShare
Loading in …5
×

使用 AWS Step Functions 開發 Serverless 服務

1,015 views

Published on

AWS Step Functions 可使用視覺化流程來輕鬆協調分散式應用程式與微型服務的各個元件。使用可執行獨立功能的個別元件來建立應用程式,能讓您迅速擴展和變更應用程式。Step Functions 是在應用程式的各個功能中協調元件與步驟的可靠方式。Step Functions 提供圖形式主控台,可將應用程式元件安排並視覺化成一連串的步驟。這讓建立和執行多步驟應用程式的工作變得簡單。Step Functions 會自動觸發和追蹤每個步驟,並在發生錯誤時重試,讓您的應用程式能如預期依序執行。Step Functions 會記錄每個步驟的狀態,一旦有哪個環節出了差錯,您就能迅速診斷並偵錯問題。您甚至不必撰寫程式碼,就能變更及新增步驟,所以您能輕鬆開發應用程式,並加快創新速度。

Published in: Technology
  • Login to see the comments

使用 AWS Step Functions 開發 Serverless 服務

  1. 1. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Yi-an Han, Senior Business Development Manager December 12, 2016 Serverless Apps with AWS Step Functions
  2. 2. What to Expect from the Session 進到無伺服器時代 AWS Step Functions 為什麼我需要使用AWS Step Functions? AWS Step Functions可以幫我做什麼事? Live Demo
  3. 3. 進到無伺服器時代
  4. 4. region Availability Zone A Web Tier Application Tier Master DB Standby DB Availability Zone B Web Tier Application Tier Traditional 3-Tier Web App
  5. 5. region Static Content Dynamic Content API Gateway Lambda DynamoDB S3 Serverless Website
  6. 6. 而價格呢?
  7. 7. The serverless compute manifesto Functions are the unit of deployment and scaling. No machines, VMs, or containers visible in the programming model. Permanent storage lives elsewhere. Scales per request. Users cannot over- or under-provision capacity. Never pay for idle (no cold servers/containers or their costs). Implicitly fault-tolerant because functions can run anywhere. BYOC – Bring your own code. Metrics and logging are a universal right.
  8. 8. Bustle.com • 52 million monthly users • 100 million events daily
  9. 9. Amazon API Gateway AWS Lambda Amazon Kinesis AWS Lambda Redis Amazon Mobile Analytics Amazon CloudWatch Amazon Elasticsearch Service Amazon S3 Amazon RedshiftAmazon QuickSightEngineering Marketing & Operations Design Bustle.com users Bustle.com event stream processing
  10. 10. Bustle.com • 52 million monthly users • 100 million events daily • 84% cost savings • 0 servers • 0 operating system patches • Automatic scaling
  11. 11. λλ λ DBMS λ λ λ λ λ λ λ λ λ Queue Modern Serverless app
  12. 12. Modern Serverless app
  13. 13. “I want to sequence functions” “I want to select functions based on data” “I want to retry functions” “I want try/catch/finally” Functions into apps “I have code that runs for hours” “I want to run functions in parallel”
  14. 14. Twelve-factor processes are stateless and share-nothing. Any data that needs to persist must be stored in a stateful backing service, typically a database.
  15. 15. Coordination by method call λ λ λ λ λ λ λ
  16. 16. Coordination by function chaining λ λ λ λ λλ λ
  17. 17. Coordination by database λλ λ λ λλ λ
  18. 18. Coordination by queues λ λ λ λ λλ λ
  19. 19. Coordination must-haves • Scales out • Doesn’t lose state • Deals with errors/timeouts • Easy to build & operate • Auditable
  20. 20. AWS Step Functions 生產力:迅速建立應用程式 AWS Step Functions 包含視覺化主控台與 常用工作流程的藍圖,讓您將分散式應用 程式的元件協調成平行和/或連續步驟的工 作變得更加容易。您可以在幾分鐘內建立 應用程式,然後加以視覺化並追蹤每個步 驟的執行,以協助確保應用程式如預期運 作。 彈性:可靠地擴展和復原 AWS Step Functions 會自動觸發每個步 驟,讓您的應用程式能如預期依序執行。 它可以同時處理上百萬個步驟,以協助確 保應用程式即使在需求增加時也可供使用。 無論步驟要花幾秒或幾個月來完成, Step Functions 都會追蹤每個步驟的狀態, 並透過內建的重試與撤回功能來處理錯誤。 靈活性:輕鬆開發應用程式 AWS Step Functions 可讓變更工作流程 和編輯步驟順序變得更容易,而不需要 修改整個應用程式。您可以重複使用元 件和步驟,甚至無須變更程式碼,以進 行實驗和加速創新。您的工作流程可以 支援上千個獨立的元件與步驟,方便您 自由建立越來越複雜的應用程式。
  21. 21. Define in JSON { "Comment": "An Amazon States Language example using a Choice state.", "StartAt": "FirstState", "States": { "FirstState": { "Type": "Task", "Resource": "arn:aws:lambda:us-east- 1:123456789012:function:FUNCTION_NAME", "Next": "ChoiceState" }, "ChoiceState": { "Type" : "Choice", "Choices": [ { "Variable": "$.foo", "NumericEquals": 1, "Next": "FirstMatchState" }, { "Variable": "$.foo", "NumericEquals": 2, "Next": "SecondMatchState" } ], "Default": "DefaultState" }, "FirstMatchState": { "Type" : "Task", "Resource": "arn:aws:lambda:us-east- 1:123456789012:function:OnFirstMatch", "Next": "NextState" }, "SecondMatchState": { "Type" : "Task", "Resource": "arn:aws:lambda:us-east- 1:123456789012:function:OnSecondMatch", "Next": "NextState" }, "DefaultState": { "Type": "Fail", "Cause": "No Matches!" }, "NextState": { "Type": "Task", "Resource": "arn:aws:lambda:us-east- 1:123456789012:function:FUNCTION_NAME", "End": true } } }
  22. 22. 視覺化方式將您的應用程式定義成一系列步驟 以視覺化方式將您的應用程式工作流程定義成一系列步驟。視覺化主控台會以執行順序自動顯 示每一步驟的圖片,讓設計多步驟應用程式的複雜工作流程變得更加輕鬆。下表提供的範例, 是一個相片分享應用程式的步驟流程,包含連續、分支與平行步驟。
  23. 23. 視覺化方式確認一切如預期運作 主控台會用不同顏色顯示每個步驟的即時狀態,並提供每個執行的詳細歷史記錄。
  24. 24. 運作的細節監看與稽核
  25. 25. 為什麼我需要使用 AWS Step Functions?
  26. 26. AWS Step Functions 可以幫我做什麼事?
  27. 27. “I want to sequence functions” AWS Step Functions, we can easily change and iterate on the application workflow of our food delivery service in order to optimize operations and continually improve delivery times. AWS Step Functions lets us dynamically scale the steps in our food delivery algorithm so we can manage spikes in customer orders and meet demand. Mathias Nitzsche, CTO, foodpanda “
  28. 28. “I want to select functions based on data” With AWS Step Functions, it was easy to build a multi-step product updating system to ensure our database and website always have the latest price and availability information. AWS Step Functions let us replace a manual updating process with an automated series of steps, including built-in retry conditions and error handling, so we can reliably scale before a big show, and keep pace with rapidly changing fashions. Jared Browarnik, CTO, TheTake “
  29. 29. “I want to retry functions” We get transient errors from a RESTful service we depend on, once every four or five times we call it. But if we keep retrying, it eventually works. “
  30. 30. { "Comment": "Call out to a RESTful service", "StartAt": "Call out", "States": { "Call out": { "Type": "Task", "Resource": "arn:aws:lambda:eu-central-1:123456789012:function:RestCallout", "Retry": [ { "ErrorEquals": [ "HandledError" ], "MaxAttempts": 10 } ], "End": true } } }
  31. 31. “I want to run functions in parallel” We want to send the captured image to three OCR providers and take the result with the highest confidence value.“
  32. 32. “I want try/catch/finally” AWS Step Functions makes it simple to coordinate information from many different infrastructure systems using easy to design workflows and create a more intelligent monitoring system for our Platform as a Service (PaaS). With AWS Step Functions, we can reliably automate monitoring decisions and actions in order to reduce human intervention by over 60%, which improves infrastructure operation productivity and customer application availability on our platform. Pedro Pimenta, VP R&D, OutSystems “
  33. 33. 13 AWS Lambda Task States 6 Choice States 1 Fail State “I want try/catch/finally”
  34. 34. "Access Media": { "Type": "Task", "Resource": "arn:aws:lambda:eu-central- 1:123456789012:function:FindMedia", "TimeoutSeconds": 2, "Next": "Graceful Exit", "Retry": [ { "ErrorEquals": [ "States.Timeout" ], "IntervalSeconds": 2, "MaxAttempts": 2, "BackoffRate": 1.5 } ], "Catch": [ { "ErrorEquals": [ "States.ALL" ], "Next": "Clean Up" } ] },
  35. 35. “I have code that runs for hours” We need to gather data from our production line, in units of 8-hour shifts. “
  36. 36. "NextShift": { "Type": "Wait", "TimestampPath": "$.ShiftStart", "Next": "Gather Plant Data" }, "Gather Plant Data": { "Type": "Task", "Resource": "arn:aws:states:ap-northeast-1:123456789012:activity:PlWatch", "TimeoutSeconds": 30000, "HeartBeatSeconds": 120, "Next": "Clean up" }
  37. 37. “I want to sequence functions” “I want to select functions based on data” “I want to retry functions” “I want try/catch/finally” Is this you? “I have code that runs for hours” “I want to run functions in parallel”
  38. 38. Live Demo
  39. 39. Thank you! yianhan@amazon.com
  40. 40. Remember to complete your evaluations!

×