?
what
can
YOU
DO
with
in
2020
Yan Cui
@theburningmonk
What do you mean
by ‘serverless’?
@theburningmonk theburningmonk.com
“Serverless”
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
Gojko Adzic
It is serverless the same way
WiFi is wireless.
http://bit.ly/2yQgwwb
@theburningmonk theburningmonk.com
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
@theburningmonk theburningmonk.com
in other words, it’s a lot like taking a cab
@theburningmonk theburningmonk.com
Ownership
Fuel
Navigate
To get there!
Focus on
getting there!
@theburningmonk theburningmonk.com
HW Ownership
OS
Runtime & Scale
Code
Physical
Servers
@theburningmonk theburningmonk.com
HW Ownership
OS
Runtime & Scale
Code
Physical
Servers
Virtual
Machines
@theburningmonk theburningmonk.com
HW Ownership
OS
Runtime & Scale
Code
Physical
Servers
Virtual
Machines
Containers
@theburningmonk theburningmonk.com
HW Ownership
OS
Runtime & Scale
Code
Focus on
getting there!
Physical
Servers
Virtual
Machines
Containers Serverless
@theburningmonk theburningmonk.com
HW Ownership
OS
Runtime & Scale
Code
Focus on
getting there!
Physical
Servers
Virtual
Machines
Containers Serverless
@theburningmonk theburningmonk.com
Serviceful Self Managed Metered Usage
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
API Gateway IOT Core SNS SQS S3
@theburningmonk theburningmonk.com
auto-scaled
by demand
@theburningmonk theburningmonk.com
scales to zero
@theburningmonk theburningmonk.com
scales to zero
don’t pay
for idle
@theburningmonk theburningmonk.com
us-east-1a
us-east-1b
us-east-1c
multi-AZ by
default
@theburningmonk theburningmonk.com
us-east-1a
us-east-1b
us-east-1c
@theburningmonk theburningmonk.com
us-east-1a
us-east-1b
us-east-1c
built-in load
balancing
@theburningmonk theburningmonk.com
us-east-1a
us-east-1b
us-east-1c
@theburningmonk theburningmonk.com
us-east-1
us-west-1
eu-west-1
us-east-1
us-west-1
eu-west-1
@theburningmonk theburningmonk.com
DynamoDB
global tables
@theburningmonk theburningmonk.com
multi-region
active-active
us-east-1
us-west-1
eu-west-1
Why serverless?
@theburningmonk theburningmonk.com
more Scalable
(and scales faster!)
@theburningmonk theburningmonk.com
Cheaper
(don’t pay for idle servers)
@theburningmonk theburningmonk.com
Resilience
(built-in redundancy and multi-AZ)
@theburningmonk theburningmonk.com
Secure
@theburningmonk theburningmonk.com
idea production
choose language
+ framework
master language
+ framework
figure out
deployment
configure AMI
configure ELB
configure
autoscaling
capacity planning
over-provision for
launch
are we doing
microservices?
configure CI/CD
@theburningmonk theburningmonk.com
idea production
choose language
+ framework
master language
+ framework
figure out
deployment
configure AMI
configure ELB
configure
autoscaling
capacity planning
over-provision for
launch
are we doing
microservices?
configure CI/CD
@theburningmonk theburningmonk.com
idea production
greater Velocity from idea to product
@theburningmonk theburningmonk.com
youtube.com/watch?v=evsz__BDprs
It used to take me
longer to configure
infrastructure for my
application!
@theburningmonk theburningmonk.com
minimise undifferentiated
heavy-lifting
@theburningmonk theburningmonk.com
less ops responsibility on
your shoulders
AWS user for 10 years
Yan Cui
http://theburningmonk.com
@theburningmonk
http://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
@theburningmonk theburningmonk.com
API Gateway Lambda DynamoDB
@theburningmonk theburningmonk.com
API Gateway
@theburningmonk theburningmonk.com
API Gateway
over 70% cheaper
@theburningmonk theburningmonk.com
https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html
@theburningmonk theburningmonk.com
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
@theburningmonk theburningmonk.com
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
@theburningmonk theburningmonk.com
1,000 TPS, 200ms avg latency, 1KB data processing / req
25 new connections per second
3000 active connections per minute
0.4 GB per hour for Lambda function targets
1000 rule evaluations per second
= 1000 / 25 = 40 LCU
= 1000 x 60s / 3000 = 20 LCU
= 1kb x 1000 x 60s x 60m / 0.4 GB = 8.58 LCU
= 1000 / 1000 = 1 LCU
@theburningmonk theburningmonk.com
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
@theburningmonk theburningmonk.com
services that pay by uptime are orders-of-magnitude
cheaper when running at scale
@theburningmonk theburningmonk.com
ALB
canary deploy with stickiness
routing based on HTTP headers
or query string params
@theburningmonk theburningmonk.com
“What about cold starts? I need predictable latency!”
@theburningmonk theburningmonk.com
first, try to optimize cold start duration so
they’re within acceptable latency range
@theburningmonk theburningmonk.com
then, consider using Provisioned Concurrency as a fallback
@theburningmonk theburningmonk.com
REST APIs
@theburningmonk theburningmonk.com
“What about websockets?”
@theburningmonk theburningmonk.com
API Gateway AppSync IoT Core
@theburningmonk theburningmonk.com
API Gateway AppSync IoT Core
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
API Gateway
Lambda
OnConnect
@theburningmonk theburningmonk.com
API Gateway
Lambda
OnConnect DynamoDB
@theburningmonk theburningmonk.com
API Gateway
Lambda
OnConnect DynamoDB
Lambda
OnDisconnect
@theburningmonk theburningmonk.com
API Gateway DynamoDBLambda
@theburningmonk theburningmonk.com
API Gateway DynamoDBLambda
@theburningmonk theburningmonk.com
low-level construct where YOU have to
manage connection mapping
@theburningmonk theburningmonk.com
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…)
@theburningmonk theburningmonk.com
API Gateway AppSync IoT Core
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
scalable, easy to use, but requires GraphQL
@theburningmonk theburningmonk.com
API Gateway AppSync IoT Core
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
requires sig v4 signing
(possibly using credentials obtained through Cognito Identity Pool)
@theburningmonk theburningmonk.com
messages are always MQTT messages
@theburningmonk theburningmonk.com
REST APIs
WebSockets
@theburningmonk theburningmonk.com
“What if I want to build a GraphQL API instead of REST?”
@theburningmonk theburningmonk.com
schema server data sources
DynamoDB
RDS
ElasticSearch
AppSync
Lambda
@theburningmonk theburningmonk.com
AWS AppSync
scalable & multi-az out of the box
@theburningmonk theburningmonk.com
AWS AppSync
scalable & multi-az out of the box
pay as you use ($4.00 per Million)
@theburningmonk theburningmonk.com
AWS AppSync
scalable & multi-az out of the box
pay as you use ($4.00 per Million)
built-in caching (extra $)
@theburningmonk theburningmonk.com
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
@theburningmonk theburningmonk.com
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
@theburningmonk theburningmonk.com
REST APIs
WebSockets
GraphQL APIs
@theburningmonk theburningmonk.com
“Can I implement data pipelines with serverless?”
@theburningmonk theburningmonk.com
Kinesis Lambda
?Publisher(s)
@theburningmonk theburningmonk.com
realworldserverless.com
@theburningmonk theburningmonk.com
Kinesis Lambda
?Publisher(s)
Firehose S3 Athena
@theburningmonk theburningmonk.com
Kinesis Lambda
?Publisher(s)
Firehose S3 Athena
Kinesis Analytics Lambda
@theburningmonk theburningmonk.com
Kinesis Lambda
?Publisher(s)
Firehose S3 Athena
Kinesis Analytics Firehose
?
@theburningmonk theburningmonk.com
Kinesis Lambda
?Publisher(s)
Firehose S3 Athena
Kinesis Analytics Kinesis
?
@theburningmonk theburningmonk.com
REST APIs
WebSockets
GraphQL APIs
Big Data
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
CloudTrail EventBridge Lambda
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
Config EventBridge Lambda
@theburningmonk theburningmonk.com
REST APIs
WebSockets
GraphQL APIs
Big Data
DevOps/DevSecOps
@theburningmonk theburningmonk.com
“How do I model complex business workflows?”
@theburningmonk theburningmonk.com
Step Functions
@theburningmonk theburningmonk.com
orchestration service that allows you to model
workflows as state machines
@theburningmonk theburningmonk.com
design with JSON
https://states-language.net/spec.html
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
Step Functions OOP
class
instanceexecution
input arguments
@theburningmonk theburningmonk.com
start a state machine via..
StepFunctions
.startExecution(req)
.promise()
@theburningmonk theburningmonk.com
start a state machine via..
API Gateway
StepFunctions
.startExecution(req)
.promise()
@theburningmonk theburningmonk.com
start a state machine via..
EventBridge
including cron
StepFunctions
.startExecution(req)
.promise()
API Gateway
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
state transitions
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
$25 PER MILLION
@theburningmonk theburningmonk.com
$25 PER MILLION
15X LAMBDA PRICING!
@theburningmonk theburningmonk.com
https://aws.amazon.com/about-aws/whats-new/2019/12/introducing-aws-step-functions-express-workflows
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
bit.ly/complete-guide-to-aws-step-functions
@theburningmonk theburningmonk.com
REST APIs
WebSockets
GraphQL APIs
Big Data
DevOps/DevSecOps
Business Workflows
@theburningmonk theburningmonk.com
“Can I encode videos with Lambda?”
@theburningmonk theburningmonk.com
S3 Lambda
?
@theburningmonk theburningmonk.com
S3 Lambda
Elemental
MediaConvert
@theburningmonk theburningmonk.com
S3 Lambda
Elemental
MediaConvert
@theburningmonk theburningmonk.com
an X min video file is likely going to take
X mins to encode
@theburningmonk theburningmonk.com
S3 Lambda Step Functions
@theburningmonk theburningmonk.com
split
@theburningmonk theburningmonk.com
Map
split
@theburningmonk theburningmonk.com
split
Map
…
@theburningmonk theburningmonk.com
split
Map
…
@theburningmonk theburningmonk.com
split
Map
…
{ … }
{ … }
{ … }
{ … }
{ … }
@theburningmonk theburningmonk.com
split
Map
…
{ … }
{ … }
{ … }
{ … }
{ … }
[{ … }, { … } … ]
@theburningmonk theburningmonk.com
Map
split stitch
@theburningmonk theburningmonk.com
Map
split stitch
@theburningmonk theburningmonk.com
Transcode video segments in parallel.
Reduced processing time from ~20 mins
to ~2 mins.
@theburningmonk theburningmonk.com
REST APIs
WebSockets
GraphQL APIs
Big Data
DevOps/DevSecOps
Video Encoding
Business Workflows
@theburningmonk theburningmonk.com
“Event-driven architectures are all the rage, how does it look like?”
@theburningmonk theburningmonk.com
“What do I use as the event bus?”
@theburningmonk theburningmonk.com
EventBridge SNS
prefer over
@theburningmonk theburningmonk.com
EventBridge SNS
@theburningmonk theburningmonk.com
EventBridge
schema discovery &
schema registry
@theburningmonk theburningmonk.com
EventBridge
content-based filtering
enables a centralized
event bus
@theburningmonk theburningmonk.com
EventBridge
AWS Services
3rd Partners
Your Application
@theburningmonk theburningmonk.com
EventBridge
AWS Services
3rd Partners
Your Application
Lambda
Lambda
Lambda
@theburningmonk theburningmonk.com
EventBridge
AWS Services
3rd Partners
Your Application
Lambda
Lambda
Lambda
@theburningmonk theburningmonk.com
“How do I handle failures?”
@theburningmonk theburningmonk.com
DLQ
@theburningmonk theburningmonk.com
SNS, SQS, Lambda,
EventBridge
@theburningmonk theburningmonk.com
FAILURE DESTINATION
@theburningmonk theburningmonk.com
FAILURE DESTINATION
@theburningmonk theburningmonk.com
FAILURE DESTINATION
@theburningmonk theburningmonk.com
FAILURE DESTINATION
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
MORE targets
Stream invocations
too!
@theburningmonk theburningmonk.com
prefer Lambda Destinations to DLQs
(both can be used side-by-side)
@theburningmonk theburningmonk.com
what about
OnSuccess?
@theburningmonk theburningmonk.com
OnSuccess
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
REST APIs
WebSockets
GraphQL APIs
Big Data
DevOps/DevSecOps
Event-Driven Architecture
Video Encoding
Business Workflows
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
LambdaAlexa Skills
@theburningmonk theburningmonk.com
REST APIs
WebSockets
GraphQL APIs
Big Data
DevOps/DevSecOps
Event-Driven Architecture
Video Encoding
Business Workflows
Alexa skills
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
IOT Core Lambda
@theburningmonk theburningmonk.com
REST APIs
WebSockets
GraphQL APIs
Big Data
DevOps/DevSecOps
Alexa skills
IOT
Event-Driven Architecture
Video Encoding
Business Workflows
@theburningmonk theburningmonk.com
REST APIs
WebSockets
GraphQL APIs
Big Data
DevOps/DevSecOps
Alexa skills
IOT
Event-Driven Architecture
Video Encoding
Business Workflows
@theburningmonk theburningmonk.com
“When is serverless not the right choice?”
@theburningmonk theburningmonk.com
What are your non-functional requirements?
@theburningmonk theburningmonk.com
Can Lambda meet your performance and scaling requirements?
@theburningmonk theburningmonk.com
What’s the Total Cost of Ownership (TCO) for serverless?
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
https://go.aws/2XThRxK
@theburningmonk theburningmonk.com
https://go.aws/2XThRxK
@theburningmonk theburningmonk.com
But, sometimes, the infrastructure far outweighs staffing cost
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
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
@theburningmonk
theburningmonk.com
github.com/theburningmonk

What can you do with lambda in 2020