3. Two-pizza team responsibility Venn diagram
Responsible for
THEIR
PRODUCT
Deployment tools
CI/CD tools
Monitoring tools
Metrics tool
Logging tools
APM tools
Infrastructure
provisioning tools
Security tools
Database management
tools
Testing tools
….
Not responsible for
*
*Unless their product belongs in the blue
4. Two-pizza team responsibility Venn diagram
Responsible for Not responsible for
*
NOT
THEIR
PRODUCT
*Unless their product belongs in the blue
Application development
Infrastructure management
Application configuration
Pipeline configuration
Alarms
Runbooks
Testing
Compliance
Roadmap tracking
Goals tracking
On-call
Support escalation
….
37. Serverless web application with AWS AppSync
AWS AppSync handles all of your
GraphQL query resolution. It can
retrieve data from data sources
such as Amazon DynamoDB,
Amazon Elasticsearch Service,
Lambda, and HTTP endpoints.
Data sources and/or Lambda
provide customer data or
backend logic.
Amazon S3
AWS Lambda
Amazon
CloudFront AWS AppSync
Amazon S3 stores all your
static content: CSS, JS,
images, more. You would
typically front this with a CDN
such as CloudFront.
45. “I want
try/catch/finally”
“I want to select tasks
based on data”
“I want to retry
failed tasks”
A
B C
A
?
“I want to
sequence tasks”
BA
“I want to run tasks
in parallel”
CBA
Is this you?
46. Coordination must-haves
• Scales out
• Doesn’t lose state
• Deals with errors/timeouts
• Easy to build & operate
• Auditable
• Keep orchestration out of code
48. Application lifecycle in AWS Step Functions
Visualize in the
Console
Define
in JSON
Monitor
Executions
49. Execute One or One Million
Start
End
HelloWorld
Start
End
HelloWorld
Start
End
HelloWorld
Start
End
HelloWorld
Start
End
HelloWorld
Start
End
HelloWorld
Start
End
HelloWorld
Start
End
HelloWorld
52. Seven state types
Task A single unit of work
Choice Adds branching logic
Parallel Fork and join the data across tasks
Wait Delay for a specified time
Fail Stops an execution and marks it as a failure
Succeed Stops an execution successfully
Pass Passes its input to its output
59. Task states for any compute
Long poll
Traditional server
Request or
Callback
Worker requests
tasks from Step
Functions
Step Functions
invokes the Task
61. Service Integration Patterns
Request Response
Call a service and let Step Functions progress to the next state
immediately after it gets an HTTP response.
"Send message to SNS": {
"Type":"Task",
"Resource":"arn:aws:states:::sns:publish",
"Parameters":{
"TopicArn":"arn:aws:sns:us-east-1:123456789012:myTopic",
"Message":"Hello from Step Functions!"
},
"Next":"NEXT_STATE"
}
62. Service Integration Patterns
Run a Job (.sync)
Call a service and have Step Functions wait for a job to complete.
"Manage Batch task": {
"Type": "Task",
"Resource": "arn:aws:states:::batch:submitJob.sync",
"Parameters": {
"JobDefinition": "arn:aws:batch:us-east-2:123456789012:job-definition/testJobDefinition",
"JobName": "testJob",
"JobQueue": "arn:aws:batch:us-east-2:123456789012:job-queue/testQueue"
},
"Next": "NEXT_STATE"
}
63. Service Integration Patterns
Wait for a Callback (.waitForTaskToken)
Call a service with a task token and have Step Functions wait until that
token is returned along with a payload.
"Send message to SQS": {
"Type": "Task",
"Resource": "arn:aws:states:::sqs:sendMessage.waitForTaskToken",
"Parameters": {
"QueueUrl": "https://sqs.us-east-2.amazonaws.com/123456789012/myQueue",
"MessageBody": {
"Message": "Hello from Step Functions!",
"TaskToken.$": "$$.Task.Token"
}
},
"Next": "NEXT_STATE"
}
65. Configure a Heartbeat Timeout for a Waiting Task
"Send message to SNS": {
"Type":"Task",
"Resource":"arn:aws:states:::sns:publish.waitForTaskToken",
"HeartbeatSeconds": 600,
"Parameters":{
"TopicArn":"arn:aws:sns:us-east-1:123456789012:myTopic",
"Message":"Let me know if everything is ok!"
},
"Next":"NEXT_STATE"
}
Set heartbeat timeout
interval to 10 minutes
66. Send task heartbeat/success/failure in JavaScript
const stepfunctions = new AWS.StepFunctions();
let data;
data = await stepfunctions.sendTaskHeartbeat({
taskToken: 'TASK_TOKEN'
}).promise();
data = await stepfunctions.sendTaskSuccess({
output: 'YOUR_OUTPUT',
taskToken: 'TASK_TOKEN'
}).promise();
data = await stepfunctions.sendTaskFailure({
error: 'ERROR_CODE’,
cause: 'EXPLANATION’,
taskToken: 'TASK_TOKEN'
}).promise();
Create service object
Send heartbeat
Send success + output
Send failure + error/cause
or
67. About WHOSAY
• WHOSAY is the largest and most
trusted influence marketer in the
world. Founded in 2010, WHOSAY is
built from the best of entertainment,
technology and advertising. WHOSAY
powers influence marketing
campaigns across all verticals and
utilizes every level of celebrity and
influencer, delivering measurably
superior results to other social and
mobile advertising.
• Step Functions is a part of the
WHOSAY MATCH application for
searching and identifying influencers
that match with brand campaigns
68. • When a celeb social media
post happens…
• Kick off a scheduled sequence
of analytics runs
Analytics data collection problem
70. Takeaways
“We can set it and
forget it, with no
maintenance, and it
is easy to support.
It was very easy to
get going.”
“Step Functions and
Lambda are a perfect
combination for building
event-driven and delayed
applications, even when
tasks need to run longer
than 5 minutes.”
71. About Thomson Reuters
• Global organization, HQ
in Toronto, 5,000+
employees
• Preparing news video
clips for global
broadcast and online
delivery
72. • Transcode 350 clips/day into
14 formats, fast
• It’s all done with FFmpeg. The
processing time is just about
100% of the video length
• Aargh!
Video processing problem
73. • Derive keyframe locations
within the source
• Split the source at the
keyframes
• Process segments (typically
0.5 sec per) in parallel
• Concatenate segments
• Elapsed time: ~20 min down
to ~2 minutes
Video processing solution
74. About Frame.io
• Frame.io is the world’s leading
workflow management platform for
video teams
• From small production agencies to
major broadcast media companies,
video teams of all sizes rely on
Frame.io to streamline their media
review and collaboration process
• Frame.io uses Step Functions to
process media, transcode to
different formats, create
thumbnails, and much more
75. 1. Sometimes Lambda is best, sometimes ECS
2. Previously, all tied together with
pub/sub and
procedural code
3. Aargh!
Media transcoding problem
76. 1. Use state machines to pick
execution engine
2. Use CloudWatch Events for
messaging and triggering
Step Functions
Media transcoding solution