Download - Serverless Microservices - Real life story of a Web App that uses AngularJS, AWS Lambda and more
Serverless MicroservicesReal life story of a Web App that uses AngularJS,
AWS Lambda and more
Eugene Istrati, Technology [email protected]
http://angular.camp
© 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
About
Eugene Istrati
• Partner @ Mitoc Group Inc
• 15+ years in IT; 7+ years on AWS
• AWS Certified Solutions Architect
• Companies: Hearst, Amazon, GrubHub, Tenaris (Europe)
Mitoc Group Inc
• www.mitocgroup.com
• Technology Company focusing on Innovative Enterprise Solutions
• AWS Technology Partner
• Featured AWS Lambda Partner
• Media and Entertainment Industry
Agenda• Reference Architecture
• Serverless Microservices
• Demo: todo.deep.mg
• Q&A
Demo: todo.deep.mg
• Inspired from open source• www.todomvc.com
• Go to the GitHub repository• github.com/MitocGroup/deep
-microservices-todomvc
• Follow the steps from Getting Started to build and deploy
• todo.deep.com
Agenda• Reference Architecture
• Serverless Microservices
• Demo: todo.deep.mg
• Q&A
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
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
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
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
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
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
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
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
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
AWS re:Invent 2014
Note: Credits and thanks are listed at the end of the presentation
AWS Summit NY 2015
Note: Credits and thanks are listed at the end of the presentation
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
Agenda• Reference Architecture
• Serverless Microservices
• Demo: todo.deep.mg
• Q&A
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
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
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
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
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
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
Serverless Architecture – App Tier
CognitoIdentity
SQS
Lambda
API Gateway
App Tier
Availability Zone A Availability Zone B
Auto Scaling Group
appservers
appservers
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
• 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
Availability Zone A Availability Zone B
Serverless Architecture – DB TierDB Tier
SQS DynamoDB
RDS Aurora
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
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
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
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
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)
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)
Google Trends: Microservices
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
Agenda• Reference Architecture
• Serverless Microservices
• Demo: todo.deep.mg
• Q&A
Demo: todo.deep.mg
• Inspired from open source• www.todomvc.com
• Go to the GitHub repository• github.com/MitocGroup/deep
-microservices-todomvc
• Follow the steps from Getting Started to build and deploy
• todo.deep.mg
Agenda• Reference Architecture
• Serverless Microservices
• Demo: todo.deep.mg
• Q&A
Q&A + Next Steps
github.com/MitocGroup [email protected]
Thanks: Willy & Forest from Open Camps
Hosting team from United Nations
http://angular.camp
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