What can you do with
Lambda in 2020?
Yan Cui, @theburningmonk
What do you mean by
‘serverless’?
“Serverless”
Gojko Adzic
It is serverless the same way
WiFi is wireless.
http://bit.ly/2yQgwwb
Serverless means…
don’t pay for it if no-one uses it
don’t need to worry about scaling
don’t need to provision and manage servers
in other words, it’s a lot like taking a cab
Ownership
Fuel
Navigate
To get there!
Focus on
getting there!
HW Ownership
OS
Runtime & Scale
Code
Focus on
getting there!
Physical
Servers
Virtual
Machines
Containers Serverless
API Gateway IOT Core SNS SQS S3
auto-scaled
by demand
scales to zero
don’t pay
for idle
us-east-1a
us-east-1b
us-east-1c
multi-AZ by
default
us-east-1a
us-east-1b
us-east-1c
built-in load
balancing
us-east-1
us-west-1
eu-west-1
us-east-1
us-west-1
eu-west-1
DynamoDB
global tables
multi-region
active-active
us-east-1
us-west-1
eu-west-1
AWS user for 10 years
Yan Cui
http://theburningmonk.com
@theburningmonk
Yan Cui
http://theburningmonk.com
@theburningmonk
bit.ly/yubl-serverless
Developer Advocate @
Yan Cui
http://theburningmonk.com
@theburningmonk
Yan Cui
http://theburningmonk.com
@theburningmonk
Independent Consultant
advisetraining delivery
realworldserverless.com
Learn GraphQL and AppSync by building a
Twitter clone with these technologies
appsyncmasterclass.com
?
what
can
YOU
DO
with
in
2020
API Gateway Lambda DynamoDB
API Gateway
API Gateway
over 70% cheaper
ALB
1 LCU gives you
25 new connections per second
3000 active connections per minute
0.4 GB per hour for Lambda function targets
1000 rule evaluations per second
* averaged over an hour
1 TPS, 200ms avg latency, 1KB data processing / req
API Gateway
ALB
$2.5921 x 60s x 60m x 24hr x 30days
@ $1.00 per hour
24hr x 30days @ $0.0225 per hour
+
1 x 24hr x 30days @ $0.008 per hour
$21.96
$9.0721 x 60s x 60m x 24hr x 30days
@ $3.50 per hour
REST
HTTP
1,000 TPS, 200ms avg latency, 1KB data processing / req
API Gateway
ALB
$25921000 x 60s x 60m x 24hr x 30days
@ $1.00 per hour
24hr x 30days @ $0.0225 per hour
+
40 x 24hr x 30days @ $0.008 per hour
$246.6
$90721000 x 60s x 60m x 24hr x 30days
@ $3.50 per hour
REST
HTTP
services that pay by uptime are orders-of-magnitude
cheaper when running at scale
“What about cold starts? I need predictable latency!”
first, try to optimize cold start duration so
they’re within acceptable latency range
then, consider using Provisioned Concurrency as a fallback
REST APIs
“What about websockets?”
API Gateway AppSync IoT Core
API Gateway AppSync IoT Core
API Gateway
Lambda
OnConnect
API Gateway
Lambda
OnConnect DynamoDB
API Gateway
Lambda
OnConnect DynamoDB
Lambda
OnDisconnect
API Gateway DynamoDBLambda
API Gateway DynamoDBLambda
low-level construct where YOU have to
manage connection mapping
no support for broadcasts
(e.g. broadcasting to a million connected users equates to fetching 1M
items from DynamoDB and then make 1M API calls to API Gateway…)
API Gateway AppSync IoT Core
scalable, easy to use, but requires GraphQL
API Gateway AppSync IoT Core
requires sig v4 signing
(possibly using credentials obtained through Cognito Identity Pool)
messages are always MQTT messages
REST APIs
WebSockets
“What if I want to build a GraphQL API instead of REST?”
schema server data sources
DynamoDB
RDS
ElasticSearch
AppSync
Lambda
AWS AppSync
scalable & multi-az out of the box
AWS AppSync
scalable & multi-az out of the box
pay as you use ($4.00 per Million)
AWS AppSync
scalable & multi-az out of the box
pay as you use ($4.00 per Million)
built-in caching (extra $)
AWS AppSync
scalable & multi-az out of the box
pay as you use ($4.00 per Million)
built-in caching (extra $)
built-in metrics through CloudWatch
built-in logging through CloudWatch Logs
AWS AppSync
scalable & multi-az out of the box
pay as you use ($4.00 per Million)
built-in caching (extra $)
built-in metrics through CloudWatch
built-in logging through CloudWatch Logs
no servers to manage
REST APIs
WebSockets
GraphQL APIs
“Can I implement data pipelines with serverless?”
Kinesis Lambda
?Publisher(s)
realworldserverless.com
Kinesis Lambda
?Publisher(s)
Firehose S3 Athena
Kinesis Lambda
?Publisher(s)
Firehose S3 Athena
Kinesis Analytics Lambda
Kinesis Lambda
?Publisher(s)
Firehose S3 Athena
Kinesis Analytics Firehose
?
Kinesis Lambda
?Publisher(s)
Firehose S3 Athena
Kinesis Analytics Kinesis
?
REST APIs
WebSockets
GraphQL APIs
Big Data
CloudTrail EventBridge Lambda
Config EventBridge Lambda
REST APIs
WebSockets
GraphQL APIs
Big Data
DevOps/DevSecOps
“How do I model complex business workflows?”
Step Functions
orchestration service that allows you to model
workflows as state machines
design with JSON
https://states-language.net/spec.html
$25 PER MILLION
$25 PER MILLION
15X LAMBDA PRICING!
bit.ly/complete-guide-to-aws-step-functions
REST APIs
WebSockets
GraphQL APIs
Big Data
DevOps/DevSecOps
Business Workflows
“Can I encode videos with Lambda?”
S3 Lambda
?
S3 Lambda
Elemental
MediaConvert
S3 Lambda
Elemental
MediaConvert
an X min video file is likely going to take
X mins to encode
S3 Lambda Step Functions
split
Map
split
split
Map
…
split
Map
…
split
Map
…
{ … }
{ … }
{ … }
{ … }
{ … }
split
Map
…
{ … }
{ … }
{ … }
{ … }
{ … }
[{ … }, { … } … ]
Map
split stitch
Map
split stitch
Transcode video segments in parallel.
Reduced processing time from ~20 mins
to ~2 mins.
REST APIs
WebSockets
GraphQL APIs
Big Data
DevOps/DevSecOps
Video Encoding
Business Workflows
“Event-driven architectures are all the rage, how does it look like?”
“What do I use as the event bus?”
EventBridge SNS
prefer over
EventBridge SNS
EventBridge
schema discovery &
schema registry
content-based filtering
enables a centralized
event bus
EventBridge
EventBridge
AWS Services
3rd Partners
Your Application
EventBridge
AWS Services
3rd Partners
Your Application
Lambda
Lambda
Lambda
EventBridge
AWS Services
3rd Partners
Your Application
Lambda
Lambda
Lambda
“How do I handle failures?”
DLQ
SNS, SQS, Lambda,
EventBridge
FAILURE DESTINATION
FAILURE DESTINATION
FAILURE DESTINATION
FAILURE DESTINATION
MORE targets
Stream invocations
too!
prefer Lambda Destinations to DLQs
(both can be used side-by-side)
what about
OnSuccess?
OnSuccess
REST APIs
WebSockets
GraphQL APIs
Big Data
DevOps/DevSecOps
Event-Driven Architecture
Video Encoding
Business Workflows
LambdaAlexa Skills
REST APIs
WebSockets
GraphQL APIs
Big Data
DevOps/DevSecOps
Event-Driven Architecture
Video Encoding
Business Workflows
Alexa skills
IOT Core Lambda
REST APIs
WebSockets
GraphQL APIs
Big Data
DevOps/DevSecOps
Alexa skills
IOT
Event-Driven Architecture
Video Encoding
Business Workflows
REST APIs
WebSockets
GraphQL APIs
Big Data
DevOps/DevSecOps
Alexa skills
IOT
Event-Driven Architecture
Video Encoding
Business Workflows
“When is serverless not the right choice?”
What are your non-functional requirements?
Can Lambda meet your performance and scaling requirements?
What’s the Total Cost of Ownership (TCO) for serverless?
https://go.aws/2XThRxK
https://go.aws/2XThRxK
But, sometimes, the infrastructure far outweighs staffing cost
https://theburningmonk.com/hire-me
AdviseTraining Delivery
“Fundamentally, Yan has improved our team by increasing our
ability to derive value from AWS and Lambda in particular.”
Nick Blair
Tech Lead
Learn GraphQL and AppSync by building a
Twitter clone with these technologies
appsyncmasterclass.com
Thank You

What can you do with lambda in 2020