SlideShare a Scribd company logo
©  2016,  Amazon  Web  Services,  Inc.  or  its  Affiliates.  All  rights  reserved.
Olivier  Klein  – Emerging  Technologies  Solutions  Architect,  Asia  Pacific
September  2016
Serverless Microservices
Build  Scalable,  Fault-­Tolerant  and  Transaction-­Safe  Microservices on  AWS
Microservices advocate  creating  a  system  
from  a  collection  of  small,  isolated  services,
each  of  which  owns  their  data,  
scalable  and  resilient  to  failure
How  to  Build  Application  Backends?
Back-­end  logic DatabaseBrowser  
/Mobile
How  to  Build  Serverless Microservices?
AWS  
Lambda
Amazon  API  
Gateway
Amazon  
DynamoDB
Microservice
How  to  Build  Serverless Microservices?
AWS  
Lambda
Amazon  API  
Gateway
Amazon  
DynamoDB
Microservice 1
Microservice 2
Microservice N
...
Amazon  API  Gateway
• Create,  publish,  maintain,  monitor  and  
secure  RESTful APIs
• Powered  by  our  content  delivery  
network  via  61  global  edge  locations
• Provides DDoS protection  and  
throttling capabilities
• Multiple  API  stages  which  you  define  
(e.g.  dev,  test,  prod)
AWS Lambda
Amazon API
Gateway
Amazon EC2
AWS API
On-­prem Server
Amazon  API  Gateway:  Authorisation
Amazon  API  
Gateway
• Allows  unauthenticated  requests,  or  
authorises via  AWS  IAM
• Amazon  Cognito or  AWS  STS  for  
temporary  credential  generation
• API  Keys  available  to  monitor  
individual  app  calls
• You  can  create  API  Key  specific  
throttling and  usage  plans
Basic  – 5  TPS
Premium  – 100  TPS
Power  – No  throttling
API  Keys  – Usage  Plans
Amazon  
Cognito
AWS  IAM
How  About  Deployments?
AWS  Lambda:  Versioning
• Immutable versions  of  functions
• Per  version  configuration
• Per  version  Cloudwatch metrics
• Cloudwatch Logs  contain  version  
attribute
• Aliases  to  “label”  a  version  release
• $LATEST  contains  latest  code
$LATEST(95) STABLE TESTING
94 X
93 X
92
Update  Alias  to  Deploy
$LATEST(95) STABLE TESTING
94 X X
93
92
Update  Alias  to  Deploy
API  Stages
API  Gateway  Stage  Variables
API  Gateway  Stage  Variables
API  Gateway Lambda Custom  Domain
/prod/Resources FunctionName:stable https://api.example.com
/dev/Resources FunctionName:$LATEST https://dev.example.com
/qa/Resources FunctionName:qa https://qa.example.com
Pin  your  Environment  with  Stage  Variables
Serverless Microservices
AWS  
Lambda
Amazon  API  
Gateway
• Highly  available
• Scalable
• Fault  tolerant
• Cost  effective
• Secure
• BUT:  Stateless!
Microservice
?
Challenge:  Centralised Database
user-­svc account-­svccart-­svc
DB
• Applications  often  have  a  
monolithic data  store
• Difficult  to  make  schema  
changes
• Technology  lock-­in
• Vertical  scaling
• Single  point  of  failure
Centralised Database  – Anti-­pattern
• Applications  often  have  a  
monolithic data  store
• Difficult  to  make  schema  
changes
• Technology  lock-­in
• Vertical  scaling
• Single  point  of  failure
user-­svc account-­svccart-­svc
DB
Decentralised Data  Stores
account-­svccart-­svc
DynamoDB RDS
user-­svc
ElastiCache RDS
• Polyglot persistence
• Each  service  chooses  it’s  
data  store  technology
• Low  impact  schema  changes
• Independent  scalability
• Data  is  gated  through  the  
service  API
CAP  Theorem
It  is  impossible  for  a  distributed  computer  system  to  
simultaneously  provide  all  3  of  the  following  guarantees:
• Consistency  
• Availability
• Partition  Tolerance
à In  the  presence  of    network  partition  we  need  to  choose  
between  consistency and  availability
Challenge:  Transactional  Integrity
• Polyglot  persistence  generally  translates  
into  eventual  consistency
• Asynchronous  calls  allow  non-­
blocking,  but  returns  need  to  be  handled  
properly
• How  about  transactional  integrity?
• Event-­sourcing  – Capture  changes  as  
sequence  of  events    
• Staged  commit
• Rollback  on  failure
ERROR
STATE?
ROLLBACK?
Let’s  try  a  Demo  – Online  Commerce
• Online  commerce  with  microservices to
• Checkout  a  cart
• Collect  payment
• Warehouse  Management
• Shipment
• High  volume  site,  out  of  stock  errors,  credit  
card  payments  with  risk  cut-­off  (<  100  USD)
• Demonstrate  successful and  failing  
transactions with  graceful  rollback
Best  Practice:  Use  Correlation  IDs
09-02-2015 15:03:24 ui-svc INFO [uuid-123] ……
09-02-2015 15:03:25 catalog-svc INFO [uuid-123] ……
09-02-2015 15:03:26 checkout-svc ERROR [uuid-123] ……
09-02-2015 15:03:27 payment-svc INFO [uuid-123] ……
09-02-2015 15:03:27 shipping-svc INFO [uuid-123] ……
ui-­svc
catalog-­
svc
checkout-­
svc
shipping-­
svc
payment-­
svc
request correlation  id:  
“uuid-­123”
correlation  id:  
“uuid-­123”
Best  Practice:  Microservice Owns  Rollback
• Every  microservice should  expose  
it’s  own  “rollback”  method
• This  method  could  just  rollback
changes,  or  trigger  subsequent  
actions (e.g.  send  notification)
• If  you  implement  staged  commit,  
also  expose  a  commit  function  
Microservice
Function  1
Rollback
Commit
(optional)
Event-­Driven:  DynamoDB Streams
• If  async,  consider  event-­driven  
approach  with  DynamoDB Streams
• Don’t  need  to  manage  function  
execution  failure,  DDB  Streams  
automatically  retries  until  successful
• “Attach”  yourself  to  the  data  of  
interest
• Kinesis,  SQS,  SNS  also  possible
Microservice
Challenge:  Report  Errors  /  Rollback
• What  if  functions  fail?  (business  logic  
failure,  not  code  failure)
• Create  a  “Transaction  Manager”  
microservice that  notifies  all  relevant  
microservices to  rollback  or  take  action
• DynamoDB is  the  trigger for  the  clean-­up
function  (could  be  SQS,  Kinesis  etc.)
• Use  Correlation  ID  to  identify  relations
mm-­svc
Transaction  
Manager  
Function
DDB  Streams
API  Call
Error  Table
Challenge:  Report  Errors  /  Rollback
ERROR
DynamoDB
Error  Table
Transaction  
Manager
Function
Kinesis
Error  Stream
SQS
Error  Queue
Rollback(co
rrelation-­id)
Rollback(co
rrelation-­id)
Rollback(co
rrelation-­id)
Rollback(co
rrelation-­id)
Challenge:  Code  Error
• Lambda  execution  error  because  of  
faulty  /  erroneous  code
• Leverage  Cloudwatch Logs  to  
process  error  message  and  call  
transaction  manager
• Set  Cloudwatch Logs  metric  filter  
to  look  for  error/exception  and  call  
Lambda  handler  upon  alarm  state
ui-­svc
Cloudwatch
Logs
Cloudwatch
Alarm
Transaction  
Manager  
Function
Beware:  Stream  Model  with  AWS  Lambda
• DynamoDB Streams  and  Kinesis  streams  directly  work  
with  AWS  Lambda,  however  AWS  Lambda  needs  to  
acknowledge  processing  the  message  correctly
• If  Lambda  fails  to  process  the  message,  the  stream  
horizon  will  not  be  moved  forward,  creating  a  “jam”
• Solution:  Monitor  AWS  Lambda  Error  Cloudwatch
Metric  and  react  when  error  rate  of  same  “Correlation  ID”  
keeps  increasing
MDM  – Keep  Data  Consistent
Databases
AWS  Lambda
“Cleanup”  
Function
Cloudwatch
Scheduled  Event
• Perform  Master  Data  Management  
(MDM)  to  keep  data  consistent
• Create  AWS  Lambda  function  to  
check  consistencies  across  
microservices and  “cleanup”
• Create  Cloudwatch Event
to  schedule  the  function  
(e.g.  hourly  basis)
Final  Thoughts
• Use  Amazon  API  Gateway  to  build  a  front-­door  to  all  your  
microservices (AWS  Lambda,  Docker,  EC2  etc.)
• Use  polyglot  persistence  to  avoid  bottlenecks,  schema  
issues  and  allow  independent  scalability  (and  cache)
• Embrace  eventual  consistency  and  design  fault-­tolerant  
business  processes  which  can  recover
• Monitor your  environment  and  cleanup whenever  
necessary  (automation  is  your  friend!)
Thank  You!

More Related Content

What's hot

AWS Security by Design
AWS Security by Design AWS Security by Design
AWS Security by Design
Amazon Web Services
 
Introduction to DevSecOps
Introduction to DevSecOpsIntroduction to DevSecOps
Introduction to DevSecOps
Amazon Web Services
 
Cloud Migration, Application Modernization, and Security
Cloud Migration, Application Modernization, and Security Cloud Migration, Application Modernization, and Security
Cloud Migration, Application Modernization, and Security
Tom Laszewski
 
Disaster Recovery Options with AWS
Disaster Recovery Options with AWSDisaster Recovery Options with AWS
Disaster Recovery Options with AWS
Amazon Web Services
 
Security Architectures on AWS
Security Architectures on AWSSecurity Architectures on AWS
Security Architectures on AWS
Amazon Web Services
 
SRV321 Deep Dive on Amazon EBS
 SRV321 Deep Dive on Amazon EBS SRV321 Deep Dive on Amazon EBS
SRV321 Deep Dive on Amazon EBS
Amazon Web Services
 
Cloud Security (AWS)
Cloud Security (AWS)Cloud Security (AWS)
Cloud Security (AWS)
Scott Arveseth
 
DEVSECOPS.pptx
DEVSECOPS.pptxDEVSECOPS.pptx
DEVSECOPS.pptx
MohammadSaif904342
 
AWS Storage and Database Architecture Best Practices (DAT203) | AWS re:Invent...
AWS Storage and Database Architecture Best Practices (DAT203) | AWS re:Invent...AWS Storage and Database Architecture Best Practices (DAT203) | AWS re:Invent...
AWS Storage and Database Architecture Best Practices (DAT203) | AWS re:Invent...
Amazon Web Services
 
Event Driven Software Architecture Pattern
Event Driven Software Architecture PatternEvent Driven Software Architecture Pattern
Event Driven Software Architecture Pattern
jeetendra mandal
 
9 Security Best Practices
9 Security Best Practices9 Security Best Practices
9 Security Best Practices
Amazon Web Services
 
IBM DataPower Gateway - Common Use Cases
IBM DataPower Gateway - Common Use CasesIBM DataPower Gateway - Common Use Cases
IBM DataPower Gateway - Common Use Cases
IBM DataPower Gateway
 
Intro to AWS: Security
Intro to AWS: SecurityIntro to AWS: Security
Intro to AWS: Security
Amazon Web Services
 
Introduction to Identity and Access Management (IAM)
Introduction to Identity and Access Management (IAM)Introduction to Identity and Access Management (IAM)
Introduction to Identity and Access Management (IAM)
Amazon Web Services
 
AWS IAM Introduction
AWS IAM IntroductionAWS IAM Introduction
AWS IAM Introduction
Amazon Web Services
 
Deep dive into AWS IAM
Deep dive into AWS IAMDeep dive into AWS IAM
Deep dive into AWS IAM
Amazon Web Services
 
Amazon S3 Masterclass
Amazon S3 MasterclassAmazon S3 Masterclass
Amazon S3 Masterclass
Amazon Web Services
 
Microservice vs. Monolithic Architecture
Microservice vs. Monolithic ArchitectureMicroservice vs. Monolithic Architecture
Microservice vs. Monolithic Architecture
Paul Mooney
 
Azure Security and Management
Azure Security and ManagementAzure Security and Management
Azure Security and Management
Allen Brokken
 
CLOUD NATIVE SECURITY
CLOUD NATIVE SECURITYCLOUD NATIVE SECURITY
CLOUD NATIVE SECURITY
Maganathin Veeraragaloo
 

What's hot (20)

AWS Security by Design
AWS Security by Design AWS Security by Design
AWS Security by Design
 
Introduction to DevSecOps
Introduction to DevSecOpsIntroduction to DevSecOps
Introduction to DevSecOps
 
Cloud Migration, Application Modernization, and Security
Cloud Migration, Application Modernization, and Security Cloud Migration, Application Modernization, and Security
Cloud Migration, Application Modernization, and Security
 
Disaster Recovery Options with AWS
Disaster Recovery Options with AWSDisaster Recovery Options with AWS
Disaster Recovery Options with AWS
 
Security Architectures on AWS
Security Architectures on AWSSecurity Architectures on AWS
Security Architectures on AWS
 
SRV321 Deep Dive on Amazon EBS
 SRV321 Deep Dive on Amazon EBS SRV321 Deep Dive on Amazon EBS
SRV321 Deep Dive on Amazon EBS
 
Cloud Security (AWS)
Cloud Security (AWS)Cloud Security (AWS)
Cloud Security (AWS)
 
DEVSECOPS.pptx
DEVSECOPS.pptxDEVSECOPS.pptx
DEVSECOPS.pptx
 
AWS Storage and Database Architecture Best Practices (DAT203) | AWS re:Invent...
AWS Storage and Database Architecture Best Practices (DAT203) | AWS re:Invent...AWS Storage and Database Architecture Best Practices (DAT203) | AWS re:Invent...
AWS Storage and Database Architecture Best Practices (DAT203) | AWS re:Invent...
 
Event Driven Software Architecture Pattern
Event Driven Software Architecture PatternEvent Driven Software Architecture Pattern
Event Driven Software Architecture Pattern
 
9 Security Best Practices
9 Security Best Practices9 Security Best Practices
9 Security Best Practices
 
IBM DataPower Gateway - Common Use Cases
IBM DataPower Gateway - Common Use CasesIBM DataPower Gateway - Common Use Cases
IBM DataPower Gateway - Common Use Cases
 
Intro to AWS: Security
Intro to AWS: SecurityIntro to AWS: Security
Intro to AWS: Security
 
Introduction to Identity and Access Management (IAM)
Introduction to Identity and Access Management (IAM)Introduction to Identity and Access Management (IAM)
Introduction to Identity and Access Management (IAM)
 
AWS IAM Introduction
AWS IAM IntroductionAWS IAM Introduction
AWS IAM Introduction
 
Deep dive into AWS IAM
Deep dive into AWS IAMDeep dive into AWS IAM
Deep dive into AWS IAM
 
Amazon S3 Masterclass
Amazon S3 MasterclassAmazon S3 Masterclass
Amazon S3 Masterclass
 
Microservice vs. Monolithic Architecture
Microservice vs. Monolithic ArchitectureMicroservice vs. Monolithic Architecture
Microservice vs. Monolithic Architecture
 
Azure Security and Management
Azure Security and ManagementAzure Security and Management
Azure Security and Management
 
CLOUD NATIVE SECURITY
CLOUD NATIVE SECURITYCLOUD NATIVE SECURITY
CLOUD NATIVE SECURITY
 

Similar to Serverless Microservices

Serverless solutions - AWS Summit SG 2017
Serverless solutions - AWS Summit SG 2017 Serverless solutions - AWS Summit SG 2017
Serverless solutions - AWS Summit SG 2017
Amazon Web Services
 
(ARC309) Getting to Microservices: Cloud Architecture Patterns
(ARC309) Getting to Microservices: Cloud Architecture Patterns(ARC309) Getting to Microservices: Cloud Architecture Patterns
(ARC309) Getting to Microservices: Cloud Architecture Patterns
Amazon Web Services
 
Being Well Architected in the Cloud
Being Well Architected in the CloudBeing Well Architected in the Cloud
Being Well Architected in the Cloud
Adrian Hornsby
 
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
Amazon Web Services
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
Amazon Web Services
 
re:Invent recap session 2: Being well Architected in the cloud
re:Invent recap session 2: Being well Architected in the cloudre:Invent recap session 2: Being well Architected in the cloud
re:Invent recap session 2: Being well Architected in the cloud
Amazon Web Services
 
Data Design and Modeling for Microservices I AWS Dev Day 2018
Data Design and Modeling for Microservices I AWS Dev Day 2018Data Design and Modeling for Microservices I AWS Dev Day 2018
Data Design and Modeling for Microservices I AWS Dev Day 2018
AWS Germany
 
ServerlessConf Tokyo キーノート
ServerlessConf Tokyo キーノートServerlessConf Tokyo キーノート
ServerlessConf Tokyo キーノート
Amazon Web Services Japan
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
Amazon Web Services
 
Secure your AWS Account and your Organization's Accounts
Secure your AWS Account and your Organization's Accounts Secure your AWS Account and your Organization's Accounts
Secure your AWS Account and your Organization's Accounts
Amazon Web Services
 
Secure Your AWS Account and Your Organization's Accounts - SID202 - Chicago A...
Secure Your AWS Account and Your Organization's Accounts - SID202 - Chicago A...Secure Your AWS Account and Your Organization's Accounts - SID202 - Chicago A...
Secure Your AWS Account and Your Organization's Accounts - SID202 - Chicago A...
Amazon Web Services
 
Cloud Management with vRealize Operations
Cloud Management with vRealize OperationsCloud Management with vRealize Operations
Cloud Management with vRealize Operations
Virtualization and Cloud Management Solutions
 
SMC301 The State of Serverless Computing
SMC301 The State of Serverless ComputingSMC301 The State of Serverless Computing
SMC301 The State of Serverless Computing
Amazon Web Services
 
2016-06 - Design your api management strategy - AWS - Microservices on AWS
2016-06 - Design your api management strategy - AWS - Microservices on AWS2016-06 - Design your api management strategy - AWS - Microservices on AWS
2016-06 - Design your api management strategy - AWS - Microservices on AWS
SmartWave
 
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
Amazon Web Services
 
AWS Public Sector Symposium 2014 Canberra | Compliance and Governance on the ...
AWS Public Sector Symposium 2014 Canberra | Compliance and Governance on the ...AWS Public Sector Symposium 2014 Canberra | Compliance and Governance on the ...
AWS Public Sector Symposium 2014 Canberra | Compliance and Governance on the ...
Amazon Web Services
 
Wild Rydes - Serverless DevOps to the Rescue
Wild Rydes - Serverless DevOps to the RescueWild Rydes - Serverless DevOps to the Rescue
Wild Rydes - Serverless DevOps to the Rescue
Amazon Web Services
 
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Stephen Liedig: Building Serverless Backends with AWS Lambda and API GatewayStephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Steve Androulakis
 
Building serverless backends - Tech talk 5 May 2017
Building serverless backends - Tech talk 5 May 2017Building serverless backends - Tech talk 5 May 2017
Building serverless backends - Tech talk 5 May 2017
ARDC
 
Workshop : Wild Rydes Takes Off - The Dawn of a New Unicorn
Workshop : Wild Rydes Takes Off - The Dawn of a New UnicornWorkshop : Wild Rydes Takes Off - The Dawn of a New Unicorn
Workshop : Wild Rydes Takes Off - The Dawn of a New Unicorn
Amazon Web Services
 

Similar to Serverless Microservices (20)

Serverless solutions - AWS Summit SG 2017
Serverless solutions - AWS Summit SG 2017 Serverless solutions - AWS Summit SG 2017
Serverless solutions - AWS Summit SG 2017
 
(ARC309) Getting to Microservices: Cloud Architecture Patterns
(ARC309) Getting to Microservices: Cloud Architecture Patterns(ARC309) Getting to Microservices: Cloud Architecture Patterns
(ARC309) Getting to Microservices: Cloud Architecture Patterns
 
Being Well Architected in the Cloud
Being Well Architected in the CloudBeing Well Architected in the Cloud
Being Well Architected in the Cloud
 
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
re:Invent recap session 2: Being well Architected in the cloud
re:Invent recap session 2: Being well Architected in the cloudre:Invent recap session 2: Being well Architected in the cloud
re:Invent recap session 2: Being well Architected in the cloud
 
Data Design and Modeling for Microservices I AWS Dev Day 2018
Data Design and Modeling for Microservices I AWS Dev Day 2018Data Design and Modeling for Microservices I AWS Dev Day 2018
Data Design and Modeling for Microservices I AWS Dev Day 2018
 
ServerlessConf Tokyo キーノート
ServerlessConf Tokyo キーノートServerlessConf Tokyo キーノート
ServerlessConf Tokyo キーノート
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Secure your AWS Account and your Organization's Accounts
Secure your AWS Account and your Organization's Accounts Secure your AWS Account and your Organization's Accounts
Secure your AWS Account and your Organization's Accounts
 
Secure Your AWS Account and Your Organization's Accounts - SID202 - Chicago A...
Secure Your AWS Account and Your Organization's Accounts - SID202 - Chicago A...Secure Your AWS Account and Your Organization's Accounts - SID202 - Chicago A...
Secure Your AWS Account and Your Organization's Accounts - SID202 - Chicago A...
 
Cloud Management with vRealize Operations
Cloud Management with vRealize OperationsCloud Management with vRealize Operations
Cloud Management with vRealize Operations
 
SMC301 The State of Serverless Computing
SMC301 The State of Serverless ComputingSMC301 The State of Serverless Computing
SMC301 The State of Serverless Computing
 
2016-06 - Design your api management strategy - AWS - Microservices on AWS
2016-06 - Design your api management strategy - AWS - Microservices on AWS2016-06 - Design your api management strategy - AWS - Microservices on AWS
2016-06 - Design your api management strategy - AWS - Microservices on AWS
 
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
 
AWS Public Sector Symposium 2014 Canberra | Compliance and Governance on the ...
AWS Public Sector Symposium 2014 Canberra | Compliance and Governance on the ...AWS Public Sector Symposium 2014 Canberra | Compliance and Governance on the ...
AWS Public Sector Symposium 2014 Canberra | Compliance and Governance on the ...
 
Wild Rydes - Serverless DevOps to the Rescue
Wild Rydes - Serverless DevOps to the RescueWild Rydes - Serverless DevOps to the Rescue
Wild Rydes - Serverless DevOps to the Rescue
 
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Stephen Liedig: Building Serverless Backends with AWS Lambda and API GatewayStephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
 
Building serverless backends - Tech talk 5 May 2017
Building serverless backends - Tech talk 5 May 2017Building serverless backends - Tech talk 5 May 2017
Building serverless backends - Tech talk 5 May 2017
 
Workshop : Wild Rydes Takes Off - The Dawn of a New Unicorn
Workshop : Wild Rydes Takes Off - The Dawn of a New UnicornWorkshop : Wild Rydes Takes Off - The Dawn of a New Unicorn
Workshop : Wild Rydes Takes Off - The Dawn of a New Unicorn
 

More from Amazon Web Services

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...
Amazon Web Services
 
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...
Amazon Web Services
 
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
Amazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
Amazon Web Services
 
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
Amazon Web Services
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
Amazon Web Services
 
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...
Amazon Web Services
 
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...
Amazon Web Services
 
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
Amazon Web Services
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
Amazon Web Services
 
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
Amazon Web Services
 
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
Amazon Web Services
 
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
Amazon Web Services
 
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
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 AWSAmazon 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 DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon 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
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
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
 

Recently uploaded

FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 

Serverless Microservices

  • 1. ©  2016,  Amazon  Web  Services,  Inc.  or  its  Affiliates.  All  rights  reserved. Olivier  Klein  – Emerging  Technologies  Solutions  Architect,  Asia  Pacific September  2016 Serverless Microservices Build  Scalable,  Fault-­Tolerant  and  Transaction-­Safe  Microservices on  AWS
  • 2. Microservices advocate  creating  a  system   from  a  collection  of  small,  isolated  services, each  of  which  owns  their  data,   scalable  and  resilient  to  failure
  • 3. How  to  Build  Application  Backends? Back-­end  logic DatabaseBrowser   /Mobile
  • 4. How  to  Build  Serverless Microservices? AWS   Lambda Amazon  API   Gateway Amazon   DynamoDB Microservice
  • 5. How  to  Build  Serverless Microservices? AWS   Lambda Amazon  API   Gateway Amazon   DynamoDB Microservice 1 Microservice 2 Microservice N ...
  • 6. Amazon  API  Gateway • Create,  publish,  maintain,  monitor  and   secure  RESTful APIs • Powered  by  our  content  delivery   network  via  61  global  edge  locations • Provides DDoS protection  and   throttling capabilities • Multiple  API  stages  which  you  define   (e.g.  dev,  test,  prod) AWS Lambda Amazon API Gateway Amazon EC2 AWS API On-­prem Server
  • 7. Amazon  API  Gateway:  Authorisation Amazon  API   Gateway • Allows  unauthenticated  requests,  or   authorises via  AWS  IAM • Amazon  Cognito or  AWS  STS  for   temporary  credential  generation • API  Keys  available  to  monitor   individual  app  calls • You  can  create  API  Key  specific   throttling and  usage  plans Basic  – 5  TPS Premium  – 100  TPS Power  – No  throttling API  Keys  – Usage  Plans Amazon   Cognito AWS  IAM
  • 9. AWS  Lambda:  Versioning • Immutable versions  of  functions • Per  version  configuration • Per  version  Cloudwatch metrics • Cloudwatch Logs  contain  version   attribute • Aliases  to  “label”  a  version  release • $LATEST  contains  latest  code
  • 10. $LATEST(95) STABLE TESTING 94 X 93 X 92 Update  Alias  to  Deploy
  • 11. $LATEST(95) STABLE TESTING 94 X X 93 92 Update  Alias  to  Deploy
  • 13. API  Gateway  Stage  Variables
  • 14. API  Gateway  Stage  Variables
  • 15. API  Gateway Lambda Custom  Domain /prod/Resources FunctionName:stable https://api.example.com /dev/Resources FunctionName:$LATEST https://dev.example.com /qa/Resources FunctionName:qa https://qa.example.com Pin  your  Environment  with  Stage  Variables
  • 16. Serverless Microservices AWS   Lambda Amazon  API   Gateway • Highly  available • Scalable • Fault  tolerant • Cost  effective • Secure • BUT:  Stateless! Microservice ?
  • 17. Challenge:  Centralised Database user-­svc account-­svccart-­svc DB • Applications  often  have  a   monolithic data  store • Difficult  to  make  schema   changes • Technology  lock-­in • Vertical  scaling • Single  point  of  failure
  • 18. Centralised Database  – Anti-­pattern • Applications  often  have  a   monolithic data  store • Difficult  to  make  schema   changes • Technology  lock-­in • Vertical  scaling • Single  point  of  failure user-­svc account-­svccart-­svc DB
  • 19. Decentralised Data  Stores account-­svccart-­svc DynamoDB RDS user-­svc ElastiCache RDS • Polyglot persistence • Each  service  chooses  it’s   data  store  technology • Low  impact  schema  changes • Independent  scalability • Data  is  gated  through  the   service  API
  • 20. CAP  Theorem It  is  impossible  for  a  distributed  computer  system  to   simultaneously  provide  all  3  of  the  following  guarantees: • Consistency   • Availability • Partition  Tolerance à In  the  presence  of    network  partition  we  need  to  choose   between  consistency and  availability
  • 21. Challenge:  Transactional  Integrity • Polyglot  persistence  generally  translates   into  eventual  consistency • Asynchronous  calls  allow  non-­ blocking,  but  returns  need  to  be  handled   properly • How  about  transactional  integrity? • Event-­sourcing  – Capture  changes  as   sequence  of  events     • Staged  commit • Rollback  on  failure ERROR STATE? ROLLBACK?
  • 22. Let’s  try  a  Demo  – Online  Commerce • Online  commerce  with  microservices to • Checkout  a  cart • Collect  payment • Warehouse  Management • Shipment • High  volume  site,  out  of  stock  errors,  credit   card  payments  with  risk  cut-­off  (<  100  USD) • Demonstrate  successful and  failing   transactions with  graceful  rollback
  • 23. Best  Practice:  Use  Correlation  IDs 09-02-2015 15:03:24 ui-svc INFO [uuid-123] …… 09-02-2015 15:03:25 catalog-svc INFO [uuid-123] …… 09-02-2015 15:03:26 checkout-svc ERROR [uuid-123] …… 09-02-2015 15:03:27 payment-svc INFO [uuid-123] …… 09-02-2015 15:03:27 shipping-svc INFO [uuid-123] …… ui-­svc catalog-­ svc checkout-­ svc shipping-­ svc payment-­ svc request correlation  id:   “uuid-­123” correlation  id:   “uuid-­123”
  • 24. Best  Practice:  Microservice Owns  Rollback • Every  microservice should  expose   it’s  own  “rollback”  method • This  method  could  just  rollback changes,  or  trigger  subsequent   actions (e.g.  send  notification) • If  you  implement  staged  commit,   also  expose  a  commit  function   Microservice Function  1 Rollback Commit (optional)
  • 25. Event-­Driven:  DynamoDB Streams • If  async,  consider  event-­driven   approach  with  DynamoDB Streams • Don’t  need  to  manage  function   execution  failure,  DDB  Streams   automatically  retries  until  successful • “Attach”  yourself  to  the  data  of   interest • Kinesis,  SQS,  SNS  also  possible Microservice
  • 26. Challenge:  Report  Errors  /  Rollback • What  if  functions  fail?  (business  logic   failure,  not  code  failure) • Create  a  “Transaction  Manager”   microservice that  notifies  all  relevant   microservices to  rollback  or  take  action • DynamoDB is  the  trigger for  the  clean-­up function  (could  be  SQS,  Kinesis  etc.) • Use  Correlation  ID  to  identify  relations mm-­svc Transaction   Manager   Function DDB  Streams API  Call Error  Table
  • 27. Challenge:  Report  Errors  /  Rollback ERROR DynamoDB Error  Table Transaction   Manager Function Kinesis Error  Stream SQS Error  Queue Rollback(co rrelation-­id) Rollback(co rrelation-­id) Rollback(co rrelation-­id) Rollback(co rrelation-­id)
  • 28. Challenge:  Code  Error • Lambda  execution  error  because  of   faulty  /  erroneous  code • Leverage  Cloudwatch Logs  to   process  error  message  and  call   transaction  manager • Set  Cloudwatch Logs  metric  filter   to  look  for  error/exception  and  call   Lambda  handler  upon  alarm  state ui-­svc Cloudwatch Logs Cloudwatch Alarm Transaction   Manager   Function
  • 29. Beware:  Stream  Model  with  AWS  Lambda • DynamoDB Streams  and  Kinesis  streams  directly  work   with  AWS  Lambda,  however  AWS  Lambda  needs  to   acknowledge  processing  the  message  correctly • If  Lambda  fails  to  process  the  message,  the  stream   horizon  will  not  be  moved  forward,  creating  a  “jam” • Solution:  Monitor  AWS  Lambda  Error  Cloudwatch Metric  and  react  when  error  rate  of  same  “Correlation  ID”   keeps  increasing
  • 30. MDM  – Keep  Data  Consistent Databases AWS  Lambda “Cleanup”   Function Cloudwatch Scheduled  Event • Perform  Master  Data  Management   (MDM)  to  keep  data  consistent • Create  AWS  Lambda  function  to   check  consistencies  across   microservices and  “cleanup” • Create  Cloudwatch Event to  schedule  the  function   (e.g.  hourly  basis)
  • 31. Final  Thoughts • Use  Amazon  API  Gateway  to  build  a  front-­door  to  all  your   microservices (AWS  Lambda,  Docker,  EC2  etc.) • Use  polyglot  persistence  to  avoid  bottlenecks,  schema   issues  and  allow  independent  scalability  (and  cache) • Embrace  eventual  consistency  and  design  fault-­tolerant   business  processes  which  can  recover • Monitor your  environment  and  cleanup whenever   necessary  (automation  is  your  friend!)