serverless microservices - real life story of a web app that uses angularjs, aws lambda and more

42
Serverless Microservices Real life story of a Web App that uses AngularJS, AWS Lambda and more Eugene Istrati, Technology Partner [email protected] www.mitocgroup.com http:// angular.camp

Upload: mitoc-group-inc

Post on 09-Jan-2017

930 views

Category:

Software


0 download

TRANSCRIPT

Page 1: 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

Page 2: Serverless Microservices - Real life story of a Web App that uses AngularJS, AWS Lambda and more

© 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

[email protected]

October 2015

ARC201

Page 3: Serverless Microservices - Real life story of a Web App that uses AngularJS, AWS Lambda and more

About

Eugene Istrati

[email protected]

• 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

Page 4: Serverless Microservices - Real life story of a Web App that uses AngularJS, AWS Lambda and more

Agenda• Reference Architecture

• Serverless Microservices

• Demo: todo.deep.mg

• Q&A

Page 5: Serverless Microservices - Real life story of a Web App that uses AngularJS, AWS Lambda and more

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

Page 6: Serverless Microservices - Real life story of a Web App that uses AngularJS, AWS Lambda and more

Agenda• Reference Architecture

• Serverless Microservices

• Demo: todo.deep.mg

• Q&A

Page 7: Serverless Microservices - Real life story of a Web App that uses AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

Agenda• Reference Architecture

• Serverless Microservices

• Demo: todo.deep.mg

• Q&A

Page 20: Serverless Microservices - Real life story of a Web App that uses AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

• 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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

Google Trends: Microservices

Page 37: Serverless Microservices - Real life story of a Web App that uses AngularJS, AWS Lambda and more

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 AngularJS, AWS Lambda and more

Agenda• Reference Architecture

• Serverless Microservices

• Demo: todo.deep.mg

• Q&A

Page 39: Serverless Microservices - Real life story of a Web App that uses AngularJS, AWS Lambda and more

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

Page 40: Serverless Microservices - Real life story of a Web App that uses AngularJS, AWS Lambda and more

Agenda• Reference Architecture

• Serverless Microservices

• Demo: todo.deep.mg

• Q&A

Page 42: Serverless Microservices - Real life story of a Web App that uses AngularJS, AWS Lambda and more

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