SlideShare a Scribd company logo
1 of 47
Download to read offline
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Scalable serverless architectures using
event-driven design
Eric Johnson
Senior Developer Advocate – AWS Serverless
M A D 3 1 0
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Who am I?
• @edjgeek
• Sr. Developer Advocate – Serverless, AWS
• Serverless/tooling/automation geek
• Dad of five (<- Not a typo)
• Husband of one
• Musician, drummer
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Why are
we here
today?
Image Source: https://pixabay.com/photos/question-mark-why-problem-solution-2123967/
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
What is serverless?
No infrastructure provisioning,
no management
Automatic scaling
Pay for value Highly available and secure
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Services (anything)
Changes in
data state
Requests to
endpoints
Changes in
resource state
Event source Function
Node.js
Python
Java
C#
Go
Serverless applications
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Serverless applications
FunctionEvent source
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Common AWS Lambda use cases
Amazon API Gateway Amazon S3
Amazon SNS
Amazon SQS
Amazon Kinesis
Data Streams
Amazon CloudWatch
Web or mobile
Backend
File processing Queue processing
Notification processingReal-time stream
processing
Schedule jobs
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Basic serverless API-based microservice
Internet/
other
services in
network
Amazon API
Gateway
AWS
Lambda
Amazon
DynamoDB
AWS Cloud
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Multiple microservices
Internet/
other
services in
network
Amazon API
Gateway
AWS
Lambda
Amazon
DynamoDB
AWS Cloud
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
The microservices “iceberg”
Common question: “Should every
service of mine talk to another using an
API?”
Maybe not!: Most microservices are
internal only for a given product
supporting their customer-facing
features. They may only need to pass
messages to each other that are simple
events and not need a full-fledged
interactive API.
Public
interface
Internal
services
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Focusing below the water line
Internal services
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Lambda execution model
Synchronous (push) Asynchronous (event) Stream
(poll-based)
Amazon
DynamoDB
Amazon
SNS
/order
Amazon
S3
reqs
Amazon Kinesis
Data Streams
changes
AWS Lambda
service
function
Amazon API
Gateway
Lambda
function
Lambda
function
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
1. Lambda directly invoked via
invoke API
SDK clients
Lambda API
API provided by the Lambda service
Used by all other services that invoke
Lambda across all models
Supports sync and async
Can pass any event payload structure you
want
Client included in every SDK
Synchronous
Lambda
function
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
2. Lambda function(s) invoked
Amazon
SNS topic
1. Data published to a topic
Data
Amazon SNS + Lambda
Simple, flexible, fully managed
publish/subscribe messaging and mobile push
notification service for high throughput, highly
reliable message delivery
Messages are published to a topic
Topics can have multiple subscribers (fanout)
Messages can be filtered and only sent to
certain subscribers
Asynchronous
Lambda
function
Lambda
function
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
1. Message
inserted into a
queue
Message
Amazon
SQS3. SQS removes
message from
queue on
successful
response from
function
2. Lambda function
invoked
Amazon SQS + Lambda
Simple, flexible, fully managed message
queuing service for reliably and
continuously exchanging any volume of
messages from anywhere
Processed in batches
At-least-once delivery
Visibility timeout allows for handling of
failures during processing
Asynchronous
Lambda
function
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
2. Lambda
polls stream
Amazon
Kinesis
Data
Stream
1. Data published to a
stream
3. Kinesis returns
stream data
Data
Amazon Kinesis Data Streams + Lambda
Fully managed, highly scalable service for
collecting and processing real-time data
streams for analytics and machine learning
Stream consists of shards with a fixed amount
of capacity and throughput
Lambda receives batches and potentially
batches of batches
Can have different applications consuming the
same stream
Stream
Lambda
function
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
AWS Step Functions + Lambda
“Serverless” workflow management
with zero administration:
Makes it easy to coordinate the
components of distributed
applications and microservices using
visual workflows
Automatically triggers and tracks each
step, and retries when there are
errors, so your application executes in
order and as expected
Can handle custom failure messages
from Lambda
Choice
Start
ExtractImageMetadata
CheckJobStatus
Rekognition
ImageTypeCheck
NotSupportedImageType
End
Thumbnail
AddRekognizedTags
Tasks
Failure capture
Parallel tasks
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Ways to compare
Pricing
Persistence
Retries
DurabilityScale/concurrency
controls
Consumption
models
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Scaling/concurrency controls
Service Scaling controls
Lambda API Concurrency is point in time, not TPS, can go from 0 up through maximum
for account per region and is shared for all functions in a region. By default
no per-function concurrency throttle is set.
Amazon Simple
Notification Service
(Amazon SNS)
Service automatically scales, use Lambda per-function concurrency setting
to control downstream consumption.
Amazon Simple Queue
Service (Amazon SQS)
Service automatically scales, use Lambda trigger batch size setting and Per
Function Concurrency setting to control downstream consumption.
Kinesis Data Streams Shards in a stream: One shard provides ingest capacity of 1MB/sec. or 1000
records/sec., up to 2MB/sec. of data output.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Lambda per-function concurrency controls
• Concurrency is a shared pool by default
• Separate using per-function concurrency settings
• Acts as reservation
• Also acts as max concurrency per function
• Especially critical for data sources like Amazon Relational Database
Service (Amazon RDS)
• “Kill switch” – set per-function concurrency to zero
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Concurrency across models
Amazon SNS/API
No event store
Queue based
Stream based
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Concurrency vs. latency
Streams
• Maximum theoretical throughput:
# shards * 2 MB / (s)
• Effective theoretical throughput:
( # shards * batch size (MB) ) / ( function
duration (s) * retries until expiry)
• If put / ingestion rate is greater than the
theoretical throughput, consider
increasing number of shards while
optimizing function duration to increase
throughput
Everything else
• Maximum processing rate :
Maximum concurrency / average
duration (events per second)
• Effective processing rate :
Effective concurrency / average duration
(events per second)
• Use concurrency metric and duration
metric to estimate processing time
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Durability
Service Durability of requests “in flight”
Lambda API Lambda API is built to be highly available but offers no durability of requests; client would
need to handle failures/retries.
Amazon SNS *Amazon SNS provides durable storage of all messages that it receives. Upon receiving a
publish request, Amazon SNS stores multiple copies (to disk) of the message across multiple
Availability Zones before acknowledging receipt of the request to the sender.
Amazon SQS *Amazon SQS stores all message queues and messages within a single, highly available AWS
Region with multiple redundant Availability Zones (AZs), so that no single computer, network,
or AZ failure can make messages inaccessible.
Kinesis Data Streams *Kinesis Data Streams synchronously replicates data across three availability zones, providing
high availability and data durability.
*Taken from relevant service FAQs
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Durability
*Taken from relevant service FAQs
Service Durability of requests “in flight”
Lambda API Lambda API is built to be highly available but offers no durability of requests; client would
need to handle failures/retries.
Amazon SNS *SNS provides durable storage of all messages that it receives. Upon receiving a publish
request, SNS stores multiple copies (to disk) of the message across multiple Availability Zones
before acknowledging receipt of the request to the sender.
Amazon SQS *Amazon SQS stores all message queues and messages within a single, highly-available AWS
region with multiple redundant Availability Zones (AZs), so that no single computer, network,
or AZ failure can make messages inaccessible.
Kinesis Data Streams *Amazon Kinesis Data Streams synchronously replicates data across three availability zones,
providing high availability and data durability
Short version: Data is replicated across multiple
Availability Zones for all 3 of these services.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Persistence
Service Persistence of requests “in flight”
Lambda API No formal persistence model.
Amazon SNS No formal persistence model beyond delivery-retry logic that extends up through
potentially 13 hours.
Amazon SQS By default messages are stored for 4 days. This can be modified to as little as 60 seconds
up to 14 days by configuring a queue’s MessageRetentionPeriod attribute.
Kinesis Data Streams By default data is stored for 24 hours. You can increase this up to 168 hours (7 days).
Extended data retention costs $0.02 per shard hour above 24 hours.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Consumption
Service Invocation model Guidance
Lambda API Can be sync or async from client to a single
invocation.
For complicated Lambda-to-Lambda workflows use
Step Functions
Amazon SNS Async to Lambda. Amazon SNS can ”fan out” to
multiple subscribing Lambda functions the same
message.
Use message filtering to control which messages go
to which subscribers. Use message delivery status to
track failures.
Amazon SQS Lambda service polls messages from queue and
invokes Lambda on your behalf. Scales polling based
on inflight messages.
Can call message delete from within your code or
let the service handle it via successful Lambda
function execution.
Kinesis Data
Streams
Lambda service polls messages from streams and
invokes Lambda on your behalf. Can run multiple
applications to consume the same stream for
different needs or use enhanced fanout to for up to
five isolated consumers per stream at
2mb/second/shard.
Use the Kinesis Client Library. Configure batch size
so that your function has enough time to complete
processing of records (which might be batches on
ingest as well).
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Retry/failure handling
Service Retry/failure capabilities
Lambda API Retry/failure logic is client dependent for synchronous invocations. For asynchronous,
invocations are retried twice by the Lambda service.
Amazon SNS If Lambda is not available, Amazon SNS will retry 2 times at 1 second apart, then 10 times
exponentially backing off from 1 second to 20 minutes and finally 38 times every 20
minutes for a total 50 attempts over more than 13 hours before the message is discarded
from Amazon SNS.
Amazon SQS Messages remain in the queue until deleted. They are prevented by being accessed by
other consumers during a period of time known as the “visibility timeout.” Successful
Lambda invocations will cause deletions of messages automatically. If an invocation fails
or doesn’t delete a message during the visibility timeout window it is made available
again for other consumers.
Kinesis Data Streams When using the Kinesis Client Library (KCL) it maintains a checkpoint/cursor of processed
records and will retry records from the same shard in order until the cursor shows
completion.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Lambda Dead Letter Queues
“By default, a failed Lambda function invoked asynchronously is retried
twice, and then the event is discarded. Using Dead Letter Queues (DLQ),
you can indicate to Lambda that unprocessed events should be sent to
an Amazon SQS queue or Amazon SNS topic instead, where you can take
further action.” –
https://docs.aws.amazon.com/lambda/latest/dg/dlq.html
• Turn this on! (for async use cases)
• Monitor it via an Amazon SQS queue length metric/alarm
• If you use Amazon SNS, send the messages to something durable
and/or a trusted endpoint for processing
•Can send to Lambda functions in other regions
• If and when things go “boom” DLQ can save your invocation event
information
☠️
✉️
Q
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Pricing
Service Model Cost per mil Factor Other
Lambda API Per request $0.20*
Amazon SNS Per request $0.50* Each 64KB chunk of
delivered data is billed as
1 request
No charge for deliveries
to Lambda
Amazon SQS Per request $0.40* Each 64 KB chunk of a
payload is billed as 1
request
A single request can have
from 1 to 10 messages
Kinesis Data Streams Per shard hour & per
request PUT payload
units
Shard per hour = $0.015
PUT payload units $0.014
Each 25KB chunk of a
payload (PUT payload
units) are billed as 1
request
Enhanced fanout and
extended data retention
(beyond 24 hours) cost
extra
* First 1 million requests are free per month
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Fan out improperly
Lambda
function
Table
Table
Bucket
Amazon
Rekognition
Amazon
Transcribe
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Fan out improperly
Lambda
function
Table
Table
Bucket
Amazon
Rekognition
Amazon
Transcribe
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Fan out improperly
Table
Table
Bucket
Amazon
Rekognition
Amazon
Transcribe
Amazon Simple Notification
Service
Topic
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Bottleneck
Amazon
Rekognition
Lambda
function
Bucket
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Bottleneck Queueing for downstream protection
Amazon
Rekognition
Lambda
function
Bucket
Amazon SQS
Queue
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Thinking synchronously
Lambda
function
Table
Bucket
Amazon
Translate
Amazon
Polly
1. Phrase submitted
2. Phrase translated
3. Phrase converted
to audio
4. Audio files stored
5. Data stored
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Thinking asynchronously
Lambda
function
Table
Bucket
Amazon
Polly
1. Phrase submitted
2. Phrase translated
4. Phrase converted
to audio
5. Audio files stored
2. Store phrase
Amazon
Translate
3. Data updated
DynamoDB stream
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Things to think about
So, what invocation resource is the right one for you?
How real-time is your “real-time” need?
•How synchronous is your synchronous workload? Would polling for updates after an
async invocation work?
Does order matter?
Do multiple services need to feed off of the same data?
What does breaking your Lambda function due to a bad code deploy have impact on?
Think about the downstream!
•What happens when a downstream service fails?
•Is there the potential to overwhelm a database or other service?
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Things to think about
So, what invocation resource is the right one for you?
• All of these services require little care and feeding in terms of management
• All are HIPAA eligible and PCI compliant
• All support fine-grained permissions via AWS Identity and Access Management (IAM)
• All have a pay-as-you-go model without commitments
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
FIN, ACK
There are many ways to get data between microservices!
• Kinesis Data Streams, Amazon SNS, Amazon SQS, and the Lambda API are just
a few of the ways
• You *might* need an API that you create yourself
• Think through the factor comparisons on scale, durability, persistence,
consumption models, retries, and pricing
• You will probably end up needing more than one and potentially end up using
each of these in some part of your infrastructure
• Evaluate and test using AWS Serverless Application Model (AWS SAM) CLI
• Serverless pricing models make testing new ideas low cost and easy to get
started with!
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
aws.amazon.com/serverless
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
aws.amazon.com/messaging
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Questions?
https://pixabay.com/illustrations/questions-font-who-what-how-why-2245264/
Thank you!
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Eric Johnson
@edjgeek

More Related Content

What's hot

Kafka replication apachecon_2013
Kafka replication apachecon_2013Kafka replication apachecon_2013
Kafka replication apachecon_2013
Jun Rao
 
AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...
AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...
AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...
Simplilearn
 

What's hot (20)

AWS re:Invent 2016: From Monolithic to Microservices: Evolving Architecture P...
AWS re:Invent 2016: From Monolithic to Microservices: Evolving Architecture P...AWS re:Invent 2016: From Monolithic to Microservices: Evolving Architecture P...
AWS re:Invent 2016: From Monolithic to Microservices: Evolving Architecture P...
 
AWS Partner Webcast - Data Center Migration to the AWS Cloud
AWS Partner Webcast - Data Center Migration to the AWS CloudAWS Partner Webcast - Data Center Migration to the AWS Cloud
AWS Partner Webcast - Data Center Migration to the AWS Cloud
 
AWS 101 Webinar: Journey to the AWS Cloud - Introduction to Cloud Computing w...
AWS 101 Webinar: Journey to the AWS Cloud - Introduction to Cloud Computing w...AWS 101 Webinar: Journey to the AWS Cloud - Introduction to Cloud Computing w...
AWS 101 Webinar: Journey to the AWS Cloud - Introduction to Cloud Computing w...
 
Kafka replication apachecon_2013
Kafka replication apachecon_2013Kafka replication apachecon_2013
Kafka replication apachecon_2013
 
Multi Tenancy In The Cloud
Multi Tenancy In The CloudMulti Tenancy In The Cloud
Multi Tenancy In The Cloud
 
Azure Reference Architectures
Azure Reference ArchitecturesAzure Reference Architectures
Azure Reference Architectures
 
Architecting for High Availability
Architecting for High AvailabilityArchitecting for High Availability
Architecting for High Availability
 
An Overview of AWS Services for Data Storage and Migration - SRV205 - Atlanta...
An Overview of AWS Services for Data Storage and Migration - SRV205 - Atlanta...An Overview of AWS Services for Data Storage and Migration - SRV205 - Atlanta...
An Overview of AWS Services for Data Storage and Migration - SRV205 - Atlanta...
 
Data Migrations - which option is best for you? | Tel Aviv Summit Tel Aviv
Data Migrations - which option is best for you? | Tel Aviv Summit Tel AvivData Migrations - which option is best for you? | Tel Aviv Summit Tel Aviv
Data Migrations - which option is best for you? | Tel Aviv Summit Tel Aviv
 
Deep Dive on Amazon RDS
Deep Dive on Amazon RDSDeep Dive on Amazon RDS
Deep Dive on Amazon RDS
 
Introduction to Amazon EC2
Introduction to Amazon EC2Introduction to Amazon EC2
Introduction to Amazon EC2
 
How to Effectively Migrate Data From Legacy Apps
How to Effectively Migrate Data From Legacy AppsHow to Effectively Migrate Data From Legacy Apps
How to Effectively Migrate Data From Legacy Apps
 
[AWS Builders] Effective AWS Glue
[AWS Builders] Effective AWS Glue[AWS Builders] Effective AWS Glue
[AWS Builders] Effective AWS Glue
 
Intro to AWS: Database Services
Intro to AWS: Database ServicesIntro to AWS: Database Services
Intro to AWS: Database Services
 
IAM Introduction and Best Practices
IAM Introduction and Best PracticesIAM Introduction and Best Practices
IAM Introduction and Best Practices
 
Effective Data Lakes: Challenges and Design Patterns (ANT316) - AWS re:Invent...
Effective Data Lakes: Challenges and Design Patterns (ANT316) - AWS re:Invent...Effective Data Lakes: Challenges and Design Patterns (ANT316) - AWS re:Invent...
Effective Data Lakes: Challenges and Design Patterns (ANT316) - AWS re:Invent...
 
AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...
AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...
AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...
 
Moving your Desktops to the Cloud with Amazon WorkSpaces
Moving your Desktops to the Cloud with Amazon WorkSpacesMoving your Desktops to the Cloud with Amazon WorkSpaces
Moving your Desktops to the Cloud with Amazon WorkSpaces
 
Building Microservices with Event Sourcing and CQRS
Building Microservices with Event Sourcing and CQRSBuilding Microservices with Event Sourcing and CQRS
Building Microservices with Event Sourcing and CQRS
 
AWS Modern Infra with Storage Roadshow 2023 - Day 2
AWS Modern Infra with Storage Roadshow 2023 - Day 2AWS Modern Infra with Storage Roadshow 2023 - Day 2
AWS Modern Infra with Storage Roadshow 2023 - Day 2
 

Similar to Scalable serverless architectures using event-driven design - MAD310 - Chicago AWS Summit

Choosing the Right Database (Database Freedom)
Choosing the Right Database (Database Freedom)Choosing the Right Database (Database Freedom)
Choosing the Right Database (Database Freedom)
Amazon Web Services
 

Similar to Scalable serverless architectures using event-driven design - MAD310 - Chicago AWS Summit (20)

Serverless Streams, Topics, Queues, & APIs! Pick the Right Serverless Applica...
Serverless Streams, Topics, Queues, & APIs! Pick the Right Serverless Applica...Serverless Streams, Topics, Queues, & APIs! Pick the Right Serverless Applica...
Serverless Streams, Topics, Queues, & APIs! Pick the Right Serverless Applica...
 
Thirty serverless architectures in 30 minutes - MAD202 - Chicago AWS Summit
Thirty serverless architectures in 30 minutes - MAD202 - Chicago AWS SummitThirty serverless architectures in 30 minutes - MAD202 - Chicago AWS Summit
Thirty serverless architectures in 30 minutes - MAD202 - Chicago AWS Summit
 
Intro to AWS Lambda and Serverless Applications: re:Invent 2018 Recap at the ...
Intro to AWS Lambda and Serverless Applications: re:Invent 2018 Recap at the ...Intro to AWS Lambda and Serverless Applications: re:Invent 2018 Recap at the ...
Intro to AWS Lambda and Serverless Applications: re:Invent 2018 Recap at the ...
 
Introduction to AWS Lambda and Serverless Applications
Introduction to AWS Lambda and Serverless ApplicationsIntroduction to AWS Lambda and Serverless Applications
Introduction to AWS Lambda and Serverless Applications
 
Favorire l'innovazione passando da applicazioni monolitiche ad architetture m...
Favorire l'innovazione passando da applicazioni monolitiche ad architetture m...Favorire l'innovazione passando da applicazioni monolitiche ad architetture m...
Favorire l'innovazione passando da applicazioni monolitiche ad architetture m...
 
Best practices for queue processing in serverless applications - MAD313 - Chi...
Best practices for queue processing in serverless applications - MAD313 - Chi...Best practices for queue processing in serverless applications - MAD313 - Chi...
Best practices for queue processing in serverless applications - MAD313 - Chi...
 
Building Event-Driven Applications with Serverless and AWS - AWS Summit New York
Building Event-Driven Applications with Serverless and AWS - AWS Summit New YorkBuilding Event-Driven Applications with Serverless and AWS - AWS Summit New York
Building Event-Driven Applications with Serverless and AWS - AWS Summit New York
 
Serverless workshop with Amazon Web Services
Serverless workshop with Amazon Web ServicesServerless workshop with Amazon Web Services
Serverless workshop with Amazon Web Services
 
The family - presentation on AWS Serverless
The family - presentation on AWS ServerlessThe family - presentation on AWS Serverless
The family - presentation on AWS Serverless
 
Thinking Asynchronously Full Vesion - Utah UG
Thinking Asynchronously Full Vesion - Utah UGThinking Asynchronously Full Vesion - Utah UG
Thinking Asynchronously Full Vesion - Utah UG
 
Thinking Asynchronously - ServerlessDays Istanbul - Oct 3 2019
Thinking Asynchronously - ServerlessDays Istanbul - Oct 3 2019 Thinking Asynchronously - ServerlessDays Istanbul - Oct 3 2019
Thinking Asynchronously - ServerlessDays Istanbul - Oct 3 2019
 
All Databases Are Equal, But Some Databases Are More Equal than Others: How t...
All Databases Are Equal, But Some Databases Are More Equal than Others: How t...All Databases Are Equal, But Some Databases Are More Equal than Others: How t...
All Databases Are Equal, But Some Databases Are More Equal than Others: How t...
 
Architetture per l'analisi di flussi di dati in tempo reale
Architetture per l'analisi di flussi di dati in tempo realeArchitetture per l'analisi di flussi di dati in tempo reale
Architetture per l'analisi di flussi di dati in tempo reale
 
Choosing the Right Database (Database Freedom)
Choosing the Right Database (Database Freedom)Choosing the Right Database (Database Freedom)
Choosing the Right Database (Database Freedom)
 
A Culture of Rapid Innovation with DevOps, Microservices, & Serverless - MAD2...
A Culture of Rapid Innovation with DevOps, Microservices, & Serverless - MAD2...A Culture of Rapid Innovation with DevOps, Microservices, & Serverless - MAD2...
A Culture of Rapid Innovation with DevOps, Microservices, & Serverless - MAD2...
 
Introduction to Serverless Computing - OOP Munich
 Introduction to Serverless Computing - OOP Munich Introduction to Serverless Computing - OOP Munich
Introduction to Serverless Computing - OOP Munich
 
갤럭시 규모의 인공지능 서비스를 위한 AWS 데이터베이스 아키텍처 - 김상필 솔루션 아키텍트 매니저, AWS / 김정환 데브옵스 엔지니어,...
갤럭시 규모의 인공지능 서비스를 위한 AWS 데이터베이스 아키텍처 - 김상필 솔루션 아키텍트 매니저, AWS / 김정환 데브옵스 엔지니어,...갤럭시 규모의 인공지능 서비스를 위한 AWS 데이터베이스 아키텍처 - 김상필 솔루션 아키텍트 매니저, AWS / 김정환 데브옵스 엔지니어,...
갤럭시 규모의 인공지능 서비스를 위한 AWS 데이터베이스 아키텍처 - 김상필 솔루션 아키텍트 매니저, AWS / 김정환 데브옵스 엔지니어,...
 
A culture of rapid innovation with DevOps, microservices, & serverless - MAD2...
A culture of rapid innovation with DevOps, microservices, & serverless - MAD2...A culture of rapid innovation with DevOps, microservices, & serverless - MAD2...
A culture of rapid innovation with DevOps, microservices, & serverless - MAD2...
 
Build data-drive, high performance, internet scale applications with AWS Data...
Build data-drive, high performance, internet scale applications with AWS Data...Build data-drive, high performance, internet scale applications with AWS Data...
Build data-drive, high performance, internet scale applications with AWS Data...
 
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
 

More from Amazon Web Services

Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 

More from Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Scalable serverless architectures using event-driven design - MAD310 - Chicago AWS Summit

  • 1. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Scalable serverless architectures using event-driven design Eric Johnson Senior Developer Advocate – AWS Serverless M A D 3 1 0
  • 2. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Who am I? • @edjgeek • Sr. Developer Advocate – Serverless, AWS • Serverless/tooling/automation geek • Dad of five (<- Not a typo) • Husband of one • Musician, drummer
  • 3. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Why are we here today? Image Source: https://pixabay.com/photos/question-mark-why-problem-solution-2123967/ S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 4. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T What is serverless? No infrastructure provisioning, no management Automatic scaling Pay for value Highly available and secure
  • 5. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Services (anything) Changes in data state Requests to endpoints Changes in resource state Event source Function Node.js Python Java C# Go Serverless applications
  • 6. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Serverless applications FunctionEvent source
  • 7. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Common AWS Lambda use cases Amazon API Gateway Amazon S3 Amazon SNS Amazon SQS Amazon Kinesis Data Streams Amazon CloudWatch Web or mobile Backend File processing Queue processing Notification processingReal-time stream processing Schedule jobs
  • 8. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 9. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Basic serverless API-based microservice Internet/ other services in network Amazon API Gateway AWS Lambda Amazon DynamoDB AWS Cloud
  • 10. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Multiple microservices Internet/ other services in network Amazon API Gateway AWS Lambda Amazon DynamoDB AWS Cloud
  • 11. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T The microservices “iceberg” Common question: “Should every service of mine talk to another using an API?” Maybe not!: Most microservices are internal only for a given product supporting their customer-facing features. They may only need to pass messages to each other that are simple events and not need a full-fledged interactive API. Public interface Internal services
  • 12. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Focusing below the water line Internal services
  • 13. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 14. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Lambda execution model Synchronous (push) Asynchronous (event) Stream (poll-based) Amazon DynamoDB Amazon SNS /order Amazon S3 reqs Amazon Kinesis Data Streams changes AWS Lambda service function Amazon API Gateway Lambda function Lambda function
  • 15. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T 1. Lambda directly invoked via invoke API SDK clients Lambda API API provided by the Lambda service Used by all other services that invoke Lambda across all models Supports sync and async Can pass any event payload structure you want Client included in every SDK Synchronous Lambda function
  • 16. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T 2. Lambda function(s) invoked Amazon SNS topic 1. Data published to a topic Data Amazon SNS + Lambda Simple, flexible, fully managed publish/subscribe messaging and mobile push notification service for high throughput, highly reliable message delivery Messages are published to a topic Topics can have multiple subscribers (fanout) Messages can be filtered and only sent to certain subscribers Asynchronous Lambda function Lambda function
  • 17. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T 1. Message inserted into a queue Message Amazon SQS3. SQS removes message from queue on successful response from function 2. Lambda function invoked Amazon SQS + Lambda Simple, flexible, fully managed message queuing service for reliably and continuously exchanging any volume of messages from anywhere Processed in batches At-least-once delivery Visibility timeout allows for handling of failures during processing Asynchronous Lambda function
  • 18. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T 2. Lambda polls stream Amazon Kinesis Data Stream 1. Data published to a stream 3. Kinesis returns stream data Data Amazon Kinesis Data Streams + Lambda Fully managed, highly scalable service for collecting and processing real-time data streams for analytics and machine learning Stream consists of shards with a fixed amount of capacity and throughput Lambda receives batches and potentially batches of batches Can have different applications consuming the same stream Stream Lambda function
  • 19. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T AWS Step Functions + Lambda “Serverless” workflow management with zero administration: Makes it easy to coordinate the components of distributed applications and microservices using visual workflows Automatically triggers and tracks each step, and retries when there are errors, so your application executes in order and as expected Can handle custom failure messages from Lambda Choice Start ExtractImageMetadata CheckJobStatus Rekognition ImageTypeCheck NotSupportedImageType End Thumbnail AddRekognizedTags Tasks Failure capture Parallel tasks
  • 20. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 21. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Ways to compare Pricing Persistence Retries DurabilityScale/concurrency controls Consumption models
  • 22. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Scaling/concurrency controls Service Scaling controls Lambda API Concurrency is point in time, not TPS, can go from 0 up through maximum for account per region and is shared for all functions in a region. By default no per-function concurrency throttle is set. Amazon Simple Notification Service (Amazon SNS) Service automatically scales, use Lambda per-function concurrency setting to control downstream consumption. Amazon Simple Queue Service (Amazon SQS) Service automatically scales, use Lambda trigger batch size setting and Per Function Concurrency setting to control downstream consumption. Kinesis Data Streams Shards in a stream: One shard provides ingest capacity of 1MB/sec. or 1000 records/sec., up to 2MB/sec. of data output.
  • 23. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Lambda per-function concurrency controls • Concurrency is a shared pool by default • Separate using per-function concurrency settings • Acts as reservation • Also acts as max concurrency per function • Especially critical for data sources like Amazon Relational Database Service (Amazon RDS) • “Kill switch” – set per-function concurrency to zero
  • 24. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Concurrency across models Amazon SNS/API No event store Queue based Stream based
  • 25. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Concurrency vs. latency Streams • Maximum theoretical throughput: # shards * 2 MB / (s) • Effective theoretical throughput: ( # shards * batch size (MB) ) / ( function duration (s) * retries until expiry) • If put / ingestion rate is greater than the theoretical throughput, consider increasing number of shards while optimizing function duration to increase throughput Everything else • Maximum processing rate : Maximum concurrency / average duration (events per second) • Effective processing rate : Effective concurrency / average duration (events per second) • Use concurrency metric and duration metric to estimate processing time
  • 26. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Durability Service Durability of requests “in flight” Lambda API Lambda API is built to be highly available but offers no durability of requests; client would need to handle failures/retries. Amazon SNS *Amazon SNS provides durable storage of all messages that it receives. Upon receiving a publish request, Amazon SNS stores multiple copies (to disk) of the message across multiple Availability Zones before acknowledging receipt of the request to the sender. Amazon SQS *Amazon SQS stores all message queues and messages within a single, highly available AWS Region with multiple redundant Availability Zones (AZs), so that no single computer, network, or AZ failure can make messages inaccessible. Kinesis Data Streams *Kinesis Data Streams synchronously replicates data across three availability zones, providing high availability and data durability. *Taken from relevant service FAQs
  • 27. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Durability *Taken from relevant service FAQs Service Durability of requests “in flight” Lambda API Lambda API is built to be highly available but offers no durability of requests; client would need to handle failures/retries. Amazon SNS *SNS provides durable storage of all messages that it receives. Upon receiving a publish request, SNS stores multiple copies (to disk) of the message across multiple Availability Zones before acknowledging receipt of the request to the sender. Amazon SQS *Amazon SQS stores all message queues and messages within a single, highly-available AWS region with multiple redundant Availability Zones (AZs), so that no single computer, network, or AZ failure can make messages inaccessible. Kinesis Data Streams *Amazon Kinesis Data Streams synchronously replicates data across three availability zones, providing high availability and data durability Short version: Data is replicated across multiple Availability Zones for all 3 of these services.
  • 28. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Persistence Service Persistence of requests “in flight” Lambda API No formal persistence model. Amazon SNS No formal persistence model beyond delivery-retry logic that extends up through potentially 13 hours. Amazon SQS By default messages are stored for 4 days. This can be modified to as little as 60 seconds up to 14 days by configuring a queue’s MessageRetentionPeriod attribute. Kinesis Data Streams By default data is stored for 24 hours. You can increase this up to 168 hours (7 days). Extended data retention costs $0.02 per shard hour above 24 hours.
  • 29. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Consumption Service Invocation model Guidance Lambda API Can be sync or async from client to a single invocation. For complicated Lambda-to-Lambda workflows use Step Functions Amazon SNS Async to Lambda. Amazon SNS can ”fan out” to multiple subscribing Lambda functions the same message. Use message filtering to control which messages go to which subscribers. Use message delivery status to track failures. Amazon SQS Lambda service polls messages from queue and invokes Lambda on your behalf. Scales polling based on inflight messages. Can call message delete from within your code or let the service handle it via successful Lambda function execution. Kinesis Data Streams Lambda service polls messages from streams and invokes Lambda on your behalf. Can run multiple applications to consume the same stream for different needs or use enhanced fanout to for up to five isolated consumers per stream at 2mb/second/shard. Use the Kinesis Client Library. Configure batch size so that your function has enough time to complete processing of records (which might be batches on ingest as well).
  • 30. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Retry/failure handling Service Retry/failure capabilities Lambda API Retry/failure logic is client dependent for synchronous invocations. For asynchronous, invocations are retried twice by the Lambda service. Amazon SNS If Lambda is not available, Amazon SNS will retry 2 times at 1 second apart, then 10 times exponentially backing off from 1 second to 20 minutes and finally 38 times every 20 minutes for a total 50 attempts over more than 13 hours before the message is discarded from Amazon SNS. Amazon SQS Messages remain in the queue until deleted. They are prevented by being accessed by other consumers during a period of time known as the “visibility timeout.” Successful Lambda invocations will cause deletions of messages automatically. If an invocation fails or doesn’t delete a message during the visibility timeout window it is made available again for other consumers. Kinesis Data Streams When using the Kinesis Client Library (KCL) it maintains a checkpoint/cursor of processed records and will retry records from the same shard in order until the cursor shows completion.
  • 31. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Lambda Dead Letter Queues “By default, a failed Lambda function invoked asynchronously is retried twice, and then the event is discarded. Using Dead Letter Queues (DLQ), you can indicate to Lambda that unprocessed events should be sent to an Amazon SQS queue or Amazon SNS topic instead, where you can take further action.” – https://docs.aws.amazon.com/lambda/latest/dg/dlq.html • Turn this on! (for async use cases) • Monitor it via an Amazon SQS queue length metric/alarm • If you use Amazon SNS, send the messages to something durable and/or a trusted endpoint for processing •Can send to Lambda functions in other regions • If and when things go “boom” DLQ can save your invocation event information ☠️ ✉️ Q
  • 32. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Pricing Service Model Cost per mil Factor Other Lambda API Per request $0.20* Amazon SNS Per request $0.50* Each 64KB chunk of delivered data is billed as 1 request No charge for deliveries to Lambda Amazon SQS Per request $0.40* Each 64 KB chunk of a payload is billed as 1 request A single request can have from 1 to 10 messages Kinesis Data Streams Per shard hour & per request PUT payload units Shard per hour = $0.015 PUT payload units $0.014 Each 25KB chunk of a payload (PUT payload units) are billed as 1 request Enhanced fanout and extended data retention (beyond 24 hours) cost extra * First 1 million requests are free per month
  • 33. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 34. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Fan out improperly Lambda function Table Table Bucket Amazon Rekognition Amazon Transcribe
  • 35. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Fan out improperly Lambda function Table Table Bucket Amazon Rekognition Amazon Transcribe
  • 36. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Fan out improperly Table Table Bucket Amazon Rekognition Amazon Transcribe Amazon Simple Notification Service Topic
  • 37. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Bottleneck Amazon Rekognition Lambda function Bucket
  • 38. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Bottleneck Queueing for downstream protection Amazon Rekognition Lambda function Bucket Amazon SQS Queue
  • 39. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Thinking synchronously Lambda function Table Bucket Amazon Translate Amazon Polly 1. Phrase submitted 2. Phrase translated 3. Phrase converted to audio 4. Audio files stored 5. Data stored
  • 40. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Thinking asynchronously Lambda function Table Bucket Amazon Polly 1. Phrase submitted 2. Phrase translated 4. Phrase converted to audio 5. Audio files stored 2. Store phrase Amazon Translate 3. Data updated DynamoDB stream
  • 41. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Things to think about So, what invocation resource is the right one for you? How real-time is your “real-time” need? •How synchronous is your synchronous workload? Would polling for updates after an async invocation work? Does order matter? Do multiple services need to feed off of the same data? What does breaking your Lambda function due to a bad code deploy have impact on? Think about the downstream! •What happens when a downstream service fails? •Is there the potential to overwhelm a database or other service?
  • 42. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Things to think about So, what invocation resource is the right one for you? • All of these services require little care and feeding in terms of management • All are HIPAA eligible and PCI compliant • All support fine-grained permissions via AWS Identity and Access Management (IAM) • All have a pay-as-you-go model without commitments
  • 43. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T FIN, ACK There are many ways to get data between microservices! • Kinesis Data Streams, Amazon SNS, Amazon SQS, and the Lambda API are just a few of the ways • You *might* need an API that you create yourself • Think through the factor comparisons on scale, durability, persistence, consumption models, retries, and pricing • You will probably end up needing more than one and potentially end up using each of these in some part of your infrastructure • Evaluate and test using AWS Serverless Application Model (AWS SAM) CLI • Serverless pricing models make testing new ideas low cost and easy to get started with!
  • 44. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T aws.amazon.com/serverless
  • 45. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T aws.amazon.com/messaging
  • 46. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Questions? https://pixabay.com/illustrations/questions-font-who-what-how-why-2245264/
  • 47. Thank you! S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Eric Johnson @edjgeek