• 1. Eugene Istrati, CTO @ Mitoc GroupMicroservices Architecturefor Digital Platforms with AWS Lambda, Amazon CloudFront, and Amazon DynamoDBeugene@mitocgroup.comOctober 2015ARC201
  • 2. Problem. Digital platforms at scale are getting slower, cost-intensive, and vulnerable to various attacks Solution. Serverless Platform-as-a-Service on AWS Presenter. Why we’re qualified to talk about this topic Dive Deep. Technical details, lessons learned, tips and tricks, and hands-on demos Success. Enable customers to achieve more by doing less
  • 3. Digital Platform ChallengesNote: Credits and thanks are listed at the end of the presentation………
  • 4. Average cost of downtime $500K - $1M / hour (IDC, Dec 2014) $140K - $540K / hour (Garner, July 2014) $474K / hour (Ponemon Inst., Dec 2013) Most commonly reported consequences Damage to reputation (38%) Increase in customer churn (37%) Damage to credit rating (28%) Increase to insurance premiums (26%)Digital Platform ChallengesNote: Credits and thanks are listed at the end of the presentation
  • 5. Digital Enterprise End-to-end Platform on AWS
  • 6. AboutEugene Istrati eugene@mitocgroup.com CTO @ Mitoc Group Inc 15+ years in IT; 7+ years on AWS AWS Certified Solutions Architect – Associate Level 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
  • 7. AgendaWeb Apps Hosting on AWS Reference Architecture Serverless Architecture Demo: Set up Serverless Environment Microservices Architecture AWS Lambda in Action Tips and Tricks Digital Enterprise End-to-end Platform Demo: dam.deep.mg Q&A + Next Steps
  • 8. Web Apps Hosting / Reference ArchitectureAvailability Zone AAvailability Zone BAuto Scaling GroupAuto Scaling Groupwww.example.comstatic.example.comweb serversweb serversapp serversapp serversScales in minutes
  • 9. Web Apps Hosting / Reference ArchitectureAvailability Zone AAvailability Zone BAuto Scaling GroupAuto Scaling Groupwww.example.comstatic.example.comweb serversweb serversapp serversapp serversScales in minutes Huge challenge for breaking news, viral content, or attacks
  • 10. Web Apps Hosting / Reference ArchitectureAvailability Zone AAvailability Zone BAuto Scaling GroupAuto Scaling Groupwww.example.comstatic.example.comweb serversweb serversapp serversapp serversScales in minutes Huge challenge for breaking news, viral content, or attacks Reduced operational complexity
  • 11. Web Apps Hosting / Reference ArchitectureAvailability Zone AAvailability Zone BAuto Scaling GroupAuto Scaling Groupwww.example.comstatic.example.comweb serversweb serversapp serversapp serversScales in minutes Huge challenge for breaking news, viral content, or attacks Reduced operational complexity Requires DevOps with experience
  • 12. Web Apps Hosting / Reference ArchitectureAvailability Zone AAvailability Zone BAuto Scaling GroupAuto Scaling Groupwww.example.comstatic.example.comweb serversweb serversapp serversapp serversScales in minutes Huge challenge for breaking news, viral content, or attacks Reduced operational complexity Requires DevOps with experience Flexible choice of technology
  • 13. Web Apps Hosting / Reference ArchitectureAvailability Zone AAvailability Zone BAuto Scaling GroupAuto Scaling Groupwww.example.comstatic.example.comweb serversweb serversapp serversapp serversScales 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
  • 14. Web Apps Hosting / Reference ArchitectureAvailability Zone AAvailability Zone BAuto Scaling GroupAuto Scaling Groupwww.example.comstatic.example.comweb serversweb serversapp serversapp serversScales 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
  • 15. Web Apps Hosting / Reference ArchitectureAvailability Zone AAvailability Zone BAuto Scaling GroupAuto Scaling Groupwww.example.comstatic.example.comweb serversweb serversapp serversapp serversScales 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
  • 16. Web Apps Hosting / Reference ArchitectureAvailability Zone AAvailability Zone BAuto Scaling GroupAuto Scaling Groupwww.example.comstatic.example.comweb serversweb serversapp serversapp serversScales 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
  • 17. AWS re:Invent 2014Note: Credits and thanks are listed at the end of the presentation
  • 18. AWS Summit NY 2015Note: Credits and thanks are listed at the end of the presentation
  • 19. Web Apps Hosting … ReinventedAvailability Zone AAvailability Zone BAuto Scaling GroupAuto Scaling Groupwww.example.comstatic.example.comweb serversweb serversapp serversapp serversS3 bucketCloudFront distributionWeb TierCognito IdentityDB TierSQSDynamoDBLambdaCloudFront logsAPI Gatewaywww.example.com static.example.comApp TierAWS RegionRDS Aurora
  • 20. AgendaWeb Apps Hosting on AWS Reference Architecture Serverless Architecture Demo: Set up Serverless Environment Microservices Architecture AWS Lambda in Action Tips and Tricks Digital Enterprise End-to-end Platform Demo: dam.deep.mg Q&A + Next Steps
  • 21. Serverless Architecture vs. ReferenceAvailability Zone AAvailability Zone BAuto Scaling GroupAuto Scaling Groupwww.example.comstatic.example.comweb serversweb serversapp serversapp serversS3 bucketCloudFront distributionWeb TierCognito IdentityDB TierSQSDynamoDBLambdaCloudFront logsAPI Gatewaywww.example.com static.example.comApp TierAWS RegionRDS Auroravs
  • 22. Serverless Architecture – Web TierS3 bucketCloudFront distributionWeb TierCognito IdentityCloudFront logswww.example.com static.example.comAvailability Zone AAvailability Zone BAuto Scaling Groupwww.example.comstatic.example.comweb serversweb servers
  • 23. Serverless Architecture – Web TierS3 bucketCloudFront distributionWeb TierCognito IdentityCloudFront logswww.example.com static.example.comStatic 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
  • 24. Serverless Architecture – Web TierS3 bucketCloudFront distributionWeb TierCognito IdentityCloudFront logswww.example.com static.example.comStatic 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
  • 25. Serverless Architecture – Web TierS3 bucketCloudFront distributionWeb TierCognito IdentityCloudFront logswww.example.com static.example.comStatic 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
  • 26. Serverless Architecture – App TierCognito IdentitySQSLambdaAPI GatewayApp TierAvailability Zone AAvailability Zone BAuto Scaling Groupapp serversapp servers
  • 27. Cognito IdentitySQSLambdaAPI GatewayApp TierAccelerated 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
  • 28. 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 TierCognito IdentitySQSLambdaAPI GatewayApp Tier
  • 29. Availability Zone AAvailability Zone BServerless Architecture – DB TierDB TierSQSDynamoDBRDS Aurora
  • 30. DB TierSQSDynamoDBRDS AuroraServerless Architecture – DB TierFirst 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
  • 31. Serverless Architecture – DB TierFirst 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 TierSQSDynamoDBRDS Aurora
  • 32. Serverless Architecture – DB TierFirst 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 TierSQSDynamoDBRDS Aurora
  • 33. AgendaWeb Apps Hosting on AWS Reference Architecture Serverless Architecture Demo: Set up Serverless Environment Microservices Architecture AWS Lambda in Action Tips and Tricks Digital Enterprise End-to-end Platform Demo: dam.deep.mg Q&A + Next Steps
  • 34. Demo: Set up Serverless Environment1. Security - Create IAM roles 2. Front-end - Create S3 bucket - Enable static website hosting - Add bucket policy - Create CloudFront distribution 3. Back-end - Create Lambda function - Upload code into Lambda - Create API Gateway endpoint 4. Database - Create DynamoDB table 5. Code - Load code into S3 bucket - View via CloudFront (S3 as backup)S3 bucketCloudFront distributionWeb TierCognito IdentityDB TierSQSDynamoDBLambdaCloudFront logsAPI Gatewaywww.example.com static.example.comApp TierAWS RegionRDS Aurora
  • 35. Lessons LearnedServerless approach is challengingly awesome Frontend is restricted to JS (and JS Frameworks) Backend is restricted to JS and Java (for now) SOA and APIs are required by design
  • 36. Lessons LearnedServerless approach is challengingly awesome Frontend is restricted to JS (and JS Frameworks) Backend is restricted to JS and Java (for now) SOA and APIs are required by design Services must be as small as possible AWS Lambda constrains Browser limitations (on mobile devices)
  • 37. Lessons LearnedServerless approach is challengingly awesome Frontend is restricted to JS (and JS Frameworks) Backend is restricted to JS and Java (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)
  • 38. Let’s Recap
  • 39. RecapAvailability Zone AAvailability Zone BAuto Scaling GroupAuto Scaling Groupwww.example.comstatic.example.comweb serversweb serversapp serversapp serversReference architecture for web application hosting on AWS
  • 40. RecapReference architecture for web application hosting on AWS Transformed to serverless architecture on AWS S3 bucketCloudFront distributionWeb TierCognito IdentityDB TierSQSDynamoDBLambdaCloudFront logsAPI Gatewaywww.example.com static.example.comApp TierAWS RegionRDS Aurora
  • 41. AgendaWeb Apps Hosting on AWS Reference Architecture Serverless Architecture Demo: Set up Serverless Environment Microservices Architecture AWS Lambda in Action Tips and Tricks Digital Enterprise End-to-end Platform Demo: dam.deep.mg Q&A + Next Steps
  • 42. Microservices ArchitectureKeynote GOTO Conference: Microservices by Martin Fowler - https://www.youtube.com/watch?v=wgdBVIX9ifAState of the Art in Microservices - https://www.youtube.com/watch?v=nMTaS07i3jkInterprocess Comms in Cloud: Pros, Cons of Microservices Architectures - https://www.youtube.com/watch?v=CriDUYtfrjs
  • 43. Speeding Up Digital Platforms on AWSDeploy in weeks Live for yearsDeploy in minutes Live for weeksDeploy in seconds Live for minutes/hoursDeploy in milliseconds Live for secondsOn-PremisesAmazon EC2Amazon ECSAWS Lambda
  • 44. AgendaWeb Apps Hosting on AWS Reference Architecture Serverless Architecture Demo: Set up Serverless Environment Microservices Architecture AWS Lambda in Action Tips and Tricks Digital Enterprise End-to-end Platform Demo: dam.deep.mg Q&A + Next Steps
  • 45. AWS Lambda in Action
  • 46. AWS Lambda in ActionAWS Lambda scaled with no effort for us 70M+ invocations / day 10K+ concurrent invocations / second
  • 47. Web Apps Hosting / Reference ArchitectureAvailability Zone AAvailability Zone BAuto Scaling GroupAuto Scaling Groupwww.example.comstatic.example.comweb serversweb serversapp serversapp serversScales 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
  • 48. AWS Lambda in ActionAWS Lambda scaled with no effort for us 70M+ invocations / day 10K+ concurrent invocations / second AWS Lambda made it really easy for us Comes pre-scaled and charges in 100ms blocks No under- or over-provisioning (by design) Developers love it (especially frontend JS folks) DevOps still in play mode (learning to build ops code)
  • 49. AgendaWeb Apps Hosting on AWS Reference Architecture Serverless Architecture Demo: Set up Serverless Environment Microservices Architecture AWS Lambda in Action Tips and Tricks Digital Enterprise End-to-end Platform Demo: dam.deep.mg Q&A + Next Steps
  • 50. Tips and TricksAWS Lambda is continuously evolving Set up alarms for all 4 Lambda metrics in Amazon CloudWatch Avoid S3 throttling by integrating S3 => SNS => Lambda Beware of potential infinite loops
  • 51. Tips and TricksAWS Lambda is continuously evolving Set up alarms for all 4 Lambda metrics in Amazon CloudWatch Avoid S3 throttling by integrating S3 => SNS => Lambda Beware of potential infinite loops Microservices are game changers The shorter TTL, the more secure it becomes First, build a service or a feature Next, break it down into microservices
  • 52. Tips and Tricks – ExampleIdentifying UI and UX needs (frontend) Show plans and related data points Manage credit cards securely Download payment receipts Identifying REST API calls (backend) Endpoint: /plans => 4 Lambdas for CRUD Endpoint: /creditcards => 4 Lambdas for CRUD Endpoint: /payments => 4 Lambdas for CRUD Identifying datasets to be stored (database) Entity: Plans Entity: CreditCards Entity: Receipts
  • 53. Tips and Tricks – ExampleIdentifying UI and UX needs (frontend) Show plans and related data points Manage credit cards securely Download payment receipts Identifying REST API calls (backend) Endpoint: /plans => 4 Lambdas for CRUD Endpoint: /creditcards => 4 Lambdas for CRUD Endpoint: /payments => 4 Lambdas for CRUD Identifying datasets to be stored (database) Entity: Plans Entity: CreditCards Entity: Receipts
  • 54. Tips and Tricks – ExampleIdentifying UI and UX needs (frontend) Show plans and related data points Manage credit cards securely Download payment receipts Identifying REST API calls (backend) Endpoint: /plans => 4 Lambdas for CRUD Endpoint: /creditcards => 4 Lambdas for CRUD Endpoint: /payments => 4 Lambdas for CRUD Identifying datasets to be stored (database) Entity: Plans Entity: CreditCards Entity: Receipts
  • 55. AgendaWeb Apps Hosting on AWS Reference Architecture Serverless Architecture Demo: Set up Serverless Environment Microservices Architecture AWS Lambda in Action Tips and Tricks Digital Enterprise End-to-end Platform Demo: dam.deep.mg Q&A + Next Steps
  • 56. AWS Products and Services
  • 57. Digital Enterprise End-to-end Platform
  • 58. DEEP is using AWS Abstracted Services
  • 59. DEEP is using Open Source Software
  • 60. DEEP Framework
  • 61. DEEP Framework – Open Sourcedhttps://github.com/MitocGroup/deep-framework
  • 62. DEEP Microservices
  • 63. DEEP Microservices – HelloWorldhttps://github.com/MitocGroup/deep-microservices-helloworld
  • 64. DEEP Management
  • 65. AgendaWeb Apps Hosting on AWS Reference Architecture Serverless Architecture Demo: Set up Serverless Environment Microservices Architecture AWS Lambda in Action Tips and Tricks Digital Enterprise End-to-end Platform Demo: dam.deep.mg Q&A + Next Steps
  • 66. Demo: dam.deep.mgCreate new digital property www.awsreinvent2015.com Publish code from origin github.com/MitocGroup/awsreinvent2015.com Open newly created website www.awsreinvent2015.comwww.awsreinvent2015.com
  • 67. Let’s Recap
  • 68. RecapReference architecture for web application hosting on AWS Transformed to serverless architecture on AWS AWS Lambda in action
  • 69. RecapReference architecture for web application hosting on AWS Transformed to serverless architecture on AWS AWS Lambda in action Tips and tricks with an example
  • 70. RecapReference architecture for web application hosting on AWS Transformed to serverless architecture on AWS AWS Lambda in action Tips and tricks with an example Digital Enterprise End-to-end Platform
  • 71. AgendaWeb Apps Hosting on AWS Reference Architecture Serverless Architecture Demo: Set up Serverless Environment Microservices Architecture AWS Lambda in Action Tips and Tricks Digital Enterprise End-to-end Platform Demo: dam.deep.mg Q&A + Next Steps
  • 72. Q&A + Next Stepsgithub.com/MitocGroupmedium.com/@MitocGroupwww.deep.mg beta@deep.mg: hello@mitocgroup.com MitocGroup
  • 73. eugene@mitocgroup.comEugene Istrati, CTO @ Mitoc Group
  • 74. (本页无文本内容)
  • 75. Credits and ThanksSlide 3: Digital Platforms Challenges http://www.buzzfeed.com/daozers/what-its-like-to-work-on-buzzfeeds-tech-team-during-record-t#.axR6WG9Yr http://www.dailydot.com/crime/new-york-magazine-ddos-bill-cosby-cover/ http://www.cio.in/topstory/flipkart%E2%80%99s-cto-explains-the-xiaome-launch-outage Slide 4: Digital Platforms Challenges http://www.slideshare.net/Radware/radware-cmg2014-tammyevertsslowtimevsdowntime http://www.statuscast.com/application-downtime-according-to-idc-gartner-and-others https://press.kaspersky.com/files/2014/11/B2B-International-2014-Survey-DDoS-Summary-Report.pdf Slide 18: AWS re:Invent 2014 https://venturebeat.com/wp-content/uploads/2014/11/aws-reinvent-lambda.png Slide 19: 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 Slide 39: Microservices Architecture https://www.youtube.com/watch?v=nMTaS07i3jk - State of the Art in Microservices by Adrian Cockcroft https://www.youtube.com/watch?v=wgdBVIX9ifA - Microservices by Martin Fowler https://www.youtube.com/watch?v=CriDUYtfrjs - Interprocess Comms in Cloud: Pros, Cons of Microservices Architectures by Sudhir Tonse
  • 76. DEEP Value Proposition
  • 77. DEEP Value PropositionCustomer drivenLow cost by defaultSimplified user experienceDeveloper friendly
  • 78. DEEP Value PropositionCustomer drivenLow cost by defaultSimplified user experienceDeveloper friendly
  • 79. DEEP Value PropositionCustomer drivenLow cost by defaultSimplified user experienceDeveloper friendly
  • 80. DEEP Value PropositionCustomer drivenLow cost by defaultSimplified user experienceDeveloper friendly
  • 81. DEEP Value Proposition – ExamplesCMS (aka Content Management System)DAM (aka Digital Asset Management)DMP (aka Data Management Platform)for image managementfor video managementfor microsite managementfor content managementfor microsite managementfor data management
  • 82. DEEP Value Proposition – ExamplesCMS (aka Content Management System)DAM (aka Digital Asset Management)DMP (aka Data Management Platform)for image managementfor video managementfor microsite managementfor content managementfor microsite managementfor data management
  • 83. DEEP Value Proposition – ExamplesCMS (aka Content Management System)DAM (aka Digital Asset Management)DMP (aka Data Management Platform)for image managementfor video managementfor microsite managementfor content managementfor microsite managementfor data management
  • 84. DEEP Microservices HelloWorld
  • 85. DEEP Microservice HelloWorld# Install deepify, DEEP CLI $ npm install deepify –g # Using deepify, create DEEP Microservice HelloWorld $ deepify helloworld ~/Microservices/deep-hello-world # Run DEEP Microservice HelloWorld locally $ deepify server ~/Microservices/deep-hello-world -o # Deploy DEEP Microservice HelloWorld to AWS $ deepify deploy ~/Microservices/deep-hello-world
  • 86. DEEP Microservice HelloWorld# Install deepify, DEEP CLI $ npm install deepify -g # Using deepify, create DEEP Microservice HelloWorld $ deepify helloworld ~/Microservices/deep-hello-world # Run DEEP Microservice HelloWorld locally $ deepify server ~/Microservices/deep-hello-world -o # Deploy DEEP Microservice HelloWorld to AWS $ deepify deploy ~/Microservices/deep-hello-world
  • 87. DEEP Microservice HelloWorld# Install deepify, DEEP CLI $ npm install deepify -g # Using deepify, create DEEP Microservice HelloWorld $ deepify helloworld ~/Microservices/deep-hello-world # Run DEEP Microservice HelloWorld locally $ deepify server ~/Microservices/deep-hello-world –o # Deploy DEEP Microservice HelloWorld to AWS $ deepify deploy ~/Microservices/deep-hello-world
  • 88. DEEP Microservice HelloWorld# Install deepify, DEEP CLI $ npm install deepify -g # Using deepify, create DEEP Microservice HelloWorld $ deepify helloworld ~/Microservices/deep-hello-world # Run DEEP Microservice HelloWorld locally $ deepify server ~/Microservices/deep-hello-world -o # Deploy DEEP Microservice HelloWorld to AWS $ deepify deploy ~/Microservices/deep-hello-world
  • 89. DEEP Microservices StructureFrontend / Backend / Models / [ModelName].json Docs / index.md Tests / deepkg.json parameters.jsonFrontend / bootstrap.js index.html images / css / js / Backend / resources.json src / [MicroserviceName] / package.json bootstrap.js Handler.js
  • 90. eugene@mitocgroup.comEugene Istrati, CTO @ Mitoc Group