AWS Lambda and Serverless framework: lessons learned while building a serverless company
Serverless Microservices - Real life story of a Web App that uses AWS Lambda
-
Upload
mitoc-group-inc -
Category
Software
-
view
333 -
download
0
Transcript of Serverless Microservices - Real life story of a Web App that uses AWS Lambda
![Page 1: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/1.jpg)
Serverless MicroservicesReal life story of a Web App that uses AWS Lambda
Eugene Istrati, Technology [email protected]
![Page 2: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/2.jpg)
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Eugen Istrati, Partner @ Mitoc Group
Microservices Architecturefor Digital Platforms with AWS Lambda,
Amazon CloudFront, and Amazon DynamoDB
October 2015
ARC201
![Page 3: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/3.jpg)
About
Eugene Istrati
• Partner @ Mitoc Group Inc
• 15+ years in IT; 7+ years on AWS
• AWS Certified Solutions Architect (re-certified at re:Invent 2015)
• Companies: Hearst, Amazon, GrubHub, Tenaris (Europe)
Mitoc Group Inc
• www.mitocgroup.com
• Web Development Studio
• AWS Technology Partner
• Focusing on enterprise applications and platforms
• Working with customers from media and entertainment industry
![Page 4: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/4.jpg)
Agenda• Reference Architecture
• Serverless Microservices
• Demo: todo.deep.mg
• Q&A
![Page 5: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/5.jpg)
Demo: todo.deep.mg
• Inspired from open source• www.todomvc.com
• Go to the GitHub repository• github.com/MitocGroup/deep
-microservices-todo-app
• Follow the steps from Getting Started to build and deploy
• todo.deep.com
![Page 6: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/6.jpg)
Agenda• Reference Architecture
• Serverless Microservices
• Demo: todo.deep.mg
• Q&A
![Page 7: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/7.jpg)
Reference Architecture
Availability Zone A Availability Zone B
Auto Scaling Group
Auto Scaling Group
www.example.com
static.example.com
webservers
webservers
appservers
appservers
• Scales in minutes
![Page 8: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/8.jpg)
Reference Architecture
Availability Zone A Availability Zone B
Auto Scaling Group
Auto Scaling Group
www.example.com
static.example.com
webservers
webservers
appservers
appservers
• Scales in minutes• Huge challenge for breaking
news, viral content, or attacks
![Page 9: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/9.jpg)
Reference Architecture
Availability Zone A Availability Zone B
Auto Scaling Group
Auto Scaling Group
www.example.com
static.example.com
webservers
webservers
appservers
appservers
• Scales in minutes• Huge challenge for breaking
news, viral content, or attacks
• Reduced operational complexity
![Page 10: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/10.jpg)
Reference Architecture
Availability Zone A Availability Zone B
Auto Scaling Group
Auto Scaling Group
www.example.com
static.example.com
webservers
webservers
appservers
appservers
• Scales in minutes• Huge challenge for breaking
news, viral content, or attacks
• Reduced operational complexity• Requires DevOps with experience
![Page 11: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/11.jpg)
Reference Architecture
Availability Zone A Availability Zone B
Auto Scaling Group
Auto Scaling Group
www.example.com
static.example.com
webservers
webservers
appservers
appservers
• Scales in minutes• Huge challenge for breaking
news, viral content, or attacks
• Reduced operational complexity• Requires DevOps with experience
• Flexible choice of technology
![Page 12: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/12.jpg)
Reference Architecture
Availability Zone A Availability Zone B
Auto Scaling Group
Auto Scaling Group
www.example.com
static.example.com
webservers
webservers
appservers
appservers
• Scales in minutes• Huge challenge for breaking
news, viral content, or attacks
• Reduced operational complexity• Requires DevOps with experience
• Flexible choice of technology• Requires devs with rich skill set
![Page 13: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/13.jpg)
Reference Architecture
Availability Zone A Availability Zone B
Auto Scaling Group
Auto Scaling Group
www.example.com
static.example.com
webservers
webservers
appservers
appservers
• Scales in minutes• Huge challenge for breaking
news, viral content, or attacks
• Reduced operational complexity• Requires DevOps with experience
• Flexible choice of technology• Requires devs with rich skill set
• Cost-effective
![Page 14: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/14.jpg)
Reference Architecture
Availability Zone A Availability Zone B
Auto Scaling Group
Auto Scaling Group
www.example.com
static.example.com
webservers
webservers
appservers
appservers
• Scales in minutes• Huge challenge for breaking
news, viral content, or attacks
• Reduced operational complexity• Requires DevOps with experience
• Flexible choice of technology• Requires devs with rich skill set
• Cost-effective• Over-provisioning and over-paying
![Page 15: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/15.jpg)
Reference Architecture
Availability Zone A Availability Zone B
Auto Scaling Group
Auto Scaling Group
www.example.com
static.example.com
webservers
webservers
appservers
appservers
• Scales in minutes• Huge challenge for breaking
news, viral content, or attacks
• Reduced operational complexity• Requires DevOps with experience
• Flexible choice of technology• Requires devs with rich skill set
• Cost-effective• Over-provisioning and over-paying
![Page 16: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/16.jpg)
AWS re:Invent 2014
Note: Credits and thanks are listed at the end of the presentation
![Page 17: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/17.jpg)
AWS Summit NY 2015
Note: Credits and thanks are listed at the end of the presentation
![Page 18: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/18.jpg)
Reference Architecture … Reinvented
Availability Zone A Availability Zone B
Auto Scaling Group
Auto Scaling Group
www.example.com
static.example.com
webservers
webservers
appservers
appservers
S3 bucket
CloudFrontdistributio
n
Web Tier
CognitoIdentity DB Tier
SQS DynamoDB
LambdaCloudFrontlogs
API Gateway
www.example.comstatic.example.com
App Tier
AWS Region RDS Aurora
![Page 19: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/19.jpg)
Agenda• Reference Architecture
• Serverless Microservices
• Demo: todo.deep.mg
• Q&A
![Page 20: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/20.jpg)
What does “serverless” mean?
Not involving a server; composed only of clients.http://www.wordsense.eu/serverless
Serverless doesn’t mean servers are no longer involved. It simply means that developers no longer have to think "that much" about them. Computing resources get used as services without having to manage around physical
capacities or limits.https://www.quora.com/What-is-Serverless-Computing
![Page 21: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/21.jpg)
Serverless vs. Reference
Availability Zone A Availability Zone B
Auto Scaling Group
Auto Scaling Group
www.example.com
static.example.com
webservers
webservers
appservers
appservers
S3 bucket
CloudFrontdistributio
n
Web Tier
CognitoIdentity DB Tier
SQS DynamoDB
LambdaCloudFrontlogs
API Gateway
www.example.comstatic.example.com
App Tier
AWS Region RDS Aurora
vs
![Page 22: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/22.jpg)
Serverless Architecture – Web Tier
S3 bucket
CloudFrontdistribution
Web Tier
CognitoIdentity
CloudFrontlogs
www.example.comstatic.example.com
Availability Zone A Availability Zone B
Auto Scaling Group
www.example.com
static.example.com
webservers
webservers
![Page 23: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/23.jpg)
Serverless Architecture – Web Tier
S3 bucket
CloudFrontdistribution
Web Tier
CognitoIdentity
CloudFrontlogs
www.example.comstatic.example.com
• Static Assets• Same as in reference architecture• css, js, docs, images, videos + html
• Dynamic Functionality• Use JS framework (e.g. Angular)• SEO-friendly (Custom Error
Response + HTML5 History API)
• Completely Serverless• Pre-scaled• Low-cost• Low-maintenance
![Page 24: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/24.jpg)
Serverless Architecture – Web Tier
S3 bucket
CloudFrontdistribution
Web Tier
CognitoIdentity
CloudFrontlogs
www.example.comstatic.example.com
• Static Assets• Same as in reference architecture• css, js, docs, images, videos + html
• Dynamic Functionality• Use JS framework (e.g. Angular)• SEO-friendly (Custom Error
Response + HTML5 History API)
• Completely Serverless• Pre-scaled• Low-cost• Low-maintenance
![Page 25: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/25.jpg)
Serverless Architecture – Web Tier
S3 bucket
CloudFrontdistribution
Web Tier
CognitoIdentity
CloudFrontlogs
www.example.comstatic.example.com
• Static Assets• Same as in reference architecture• css, js, docs, images, videos + html
• Dynamic Functionality• Use JS framework (e.g. Angular)• SEO-friendly (Custom Error
Response + HTML5 History API)
• Completely Serverless• Pre-scaled• Low-cost• Low-maintenance
![Page 26: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/26.jpg)
Serverless Architecture – App Tier
CognitoIdentity
SQS
Lambda
API Gateway
App Tier
Availability Zone A Availability Zone B
Auto Scaling Group
appservers
appservers
![Page 27: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/27.jpg)
CognitoIdentity
SQS
Lambda
API Gateway
App Tier • Accelerated Backend• Write node.js functions and load
into Lambda• Power up Lambda with RESTful
endpoints on API Gateway• Cache, throttle, meter, version, etc.
• Completely Serverless• Pre-scaled• Low-cost• Low-maintenance
Serverless Architecture – App Tier
![Page 28: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/28.jpg)
• Accelerated Backend• Write node.js functions and load
into Lambda• Power up Lambda with RESTful
endpoints on API Gateway• Cache, throttle, meter, version, etc.
• Completely Serverless• Pre-scaled• Low-cost• Low-maintenance
Serverless Architecture – App Tier
CognitoIdentity
SQS
Lambda
API Gateway
App Tier
![Page 29: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/29.jpg)
Availability Zone A Availability Zone B
Serverless Architecture – DB TierDB Tier
SQS DynamoDB
RDS Aurora
![Page 30: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/30.jpg)
DB Tier
SQS DynamoDB
RDS Aurora
Serverless Architecture – DB Tier• First choice – DynamoDB + SQS
• Schema-free• Scale only reads and writes
• Completely Serverless• Pre-scaled• Low-cost• Low-maintenance
• Next choice – RDS Aurora• Relational• MySQL-like approach, but 5x better
![Page 31: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/31.jpg)
Serverless Architecture – DB Tier• First choice – DynamoDB + SQS
• Schema-free• Scale only reads and writes
• Completely Serverless• Pre-scaled• Low-cost• Low-maintenance
• Next choice – RDS Aurora• Relational• MySQL-like approach, but 5x better
DB Tier
SQS DynamoDB
RDS Aurora
![Page 32: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/32.jpg)
Serverless Architecture – DB Tier• First choice – DynamoDB + SQS
• Schema-free• Scale only reads and writes
• Completely Serverless• Pre-scaled• Low-cost• Low-maintenance
• Next choice – RDS Aurora• Relational• MySQL-like approach, but 5x better
DB Tier
SQS DynamoDB
RDS Aurora
![Page 33: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/33.jpg)
Lessons Learned
• Serverless approach is challengingly awesome
• Frontend is restricted to JS (and JS Frameworks)• Backend is restricted to Python, Java or JS (for now)• SOA and APIs are required by design
![Page 34: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/34.jpg)
Lessons Learned
• Serverless approach is challengingly awesome
• Frontend is restricted to JS (and JS Frameworks)• Backend is restricted to Python, Java or JS (for now)• SOA and APIs are required by design
• Services must be as small as possible
• AWS Lambda constrains• Browser limitations (on mobile devices)
![Page 35: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/35.jpg)
Lessons Learned
• Serverless approach is challengingly awesome
• Frontend is restricted to JS (and JS Frameworks)• Backend is restricted to Python, Java or JS (for now)• SOA and APIs are required by design
• Services must be as small as possible => microservices
• AWS Lambda constrains• Browser limitations (on mobile devices)
![Page 36: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/36.jpg)
Google Trends: Microservices
![Page 37: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/37.jpg)
What does “microservices” mean?
In computing, microservices is a software architecture style in which complex applications are composed of small, independent processes communicating with each other using language-agnostic APIs. These services are small, highly
decoupled and focus on doing a small task, facilitating a modular approach to system-
building.https://en.wikipedia.org/wiki/Microservices
![Page 38: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/38.jpg)
Agenda• Reference Architecture
• Serverless Microservices
• Demo: todo.deep.mg
• Q&A
![Page 39: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/39.jpg)
Demo: todo.deep.mg
• Inspired from open source• www.todomvc.com
• Go to the GitHub repository• github.com/MitocGroup/deep
-microservices-todo-app
• Follow the steps from Getting Started to build and deploy
• todo.deep.mg
![Page 40: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/40.jpg)
Agenda• Reference Architecture
• Serverless Microservices
• Demo: todo.deep.mg
• Q&A
![Page 42: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/42.jpg)
DEEP Frameworkhttps://github.com/MitocGroup/deep-framework
“DEEP Framework is a serverless web framework, core component of the Platform-as-a-Service that abstracts web apps and web services from specific cloud providers. This
framework enables developers build cloud-native applications or platforms using microservices architecture in a completely
serverless approach”
![Page 43: Serverless Microservices - Real life story of a Web App that uses AWS Lambda](https://reader031.fdocuments.us/reader031/viewer/2022030214/5899f5ca1a28abc5778b4e31/html5/thumbnails/43.jpg)
Credits and Thanks• Slide 19: AWS re:Invent 2014
• https://venturebeat.com/wp-content/uploads/2014/11/aws-reinvent-lambda.png
• Slide 20: AWS Summit NY 2015• https://d0.awsstatic.com/events/aws-hosted-events/2015/AWS-Global-Summit-Series/new-york/press-room/introducing-amazon-api-
gateway.jpg