Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Serverless Architectures on AWS in practice - OSCON 2018


Published on

From functions to containers to databases, serverless is a huge paradigm shift. The ability to only pay for what we use and not worry about underlying infrastructure is very tempting to developers and DevOps engineers, and the rate of innovation in this area has been very rapid across all major public cloud providers. Serverless architectures are the natural evolution of microservices design. While Lambda has become synonymous with serverless in AWS, there are several new and upcoming patterns that take serverless architectures to the next level.

Manish Pandit explains how to identify these patterns and put them to use. Using Marqeta’s efforts to move its payments infrastructure to the public cloud as an example, Manish explores the services that Marqeta considered, customized, hacked around, and successfully implemented as a part of this move.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Serverless Architectures on AWS in practice - OSCON 2018

  1. 1. Serverless Architectures on AWS in practice Manish Pandit 07/19/2018
  2. 2. If I had asked people what they wanted, they would have said: “faster horses” -Henry Ford
  3. 3. The Journey
  4. 4. About Me Manish Pandit Director of Platform Engineering @marqeta @lobster1234
  5. 5. Why? Scale technology to support the growing business Use public cloud capabilities so we can focus on product innovation
  6. 6. Break down the monolith
  7. 7. Shrink the Infrastructure
  8. 8. Cloud-Native-First Mindset ..and many more
  9. 9. Microservices Independent development, deployment, and scaling of functionally isolated services.
  10. 10. Microservices “Loosely coupled, yet highly aligned”
  11. 11. Microservices You can have microservices without containers and serverless! Containers and Serverless are the most optimal way to package and deploy microservices.
  12. 12. Abstractions Bare Metal O/S Application Fn Serverless Containers VMs Hardware
  13. 13. Containers Distributed Applications/Services Economics of Scale - Optimal Resource Utilization Being lightweight, they’re fast to deploy and run
  14. 14. Serverless Function as a unit of deployment (FaaS) Pay for what you use, never for idle resources 100% abstraction from underlying resources
  15. 15. Serverless Components 1. Functions themselves 2. Events that trigger these functions, or handlers Event driven programming - Functions are event handlers You only pay when the handler runs
  16. 16. Lambda Amazon’s FaaS Supports Node, Python, Java 8, C#, Go Billed as GB-seconds
  17. 17. Lambda Pricing First 1M requests per month are free 400,000 GB-seconds per month are free START RequestId: 6bd9cf60-7e2b-11e8-9f4a-ebdea81e794d Version: $LATEST END RequestId: 6bd9cf60-7e2b-11e8-9f4a-ebdea81e794d REPORT RequestId: 6bd9cf60-7e2b-11e8-9f4a-ebdea81e794d Duration: 646.26 ms Billed Duration: 700 ms Memory Size: 128 MB Max Memory Used: 31 MB
  18. 18. Use Cases
  19. 19. Consul Backups GET /v1/catalog/service/mqapi PutObject trigger
  20. 20. Database Replication Jobs Get updates PutObject trigger apply
  21. 21. Async Events publish publish trigger trigger Service A Service B Service C ECS
  22. 22. File Processing Pipeline Split PGP & Transfer Payment Networks Banks trigger trigger N 1 Object + Metadata
  23. 23. Lambda limits Memory : 128-3008 MB with 64 MB increments Time : 300 seconds
  24. 24. Batch Jobs
  25. 25. AWS Batch : Managed Compute https://.. Submitter Job Job Job Batch Cloudwatch Event
  26. 26. Containers not Serverless Enough? = ECS minus the Cluster
  27. 27. Logging For Lambdas, Cloudwatch logs For ECS, filebeat agent on the host For Fargate, LogStashTcpSocketAppender
  28. 28. Monitoring and Alerting
  29. 29. Testing Docker Compose Localstack Use environment variables for configuration (12-Factor App)
  30. 30. Gotchas.. - Lambda Cold start on both Python and Java - Due to VPC and ENI - Be aware of the retries - Async invocation gets two retries - Sync invocation gets no retries - Apply the Principle of Least Privilege to the Lambda and ECS Roles - S3 triggers - source and destination buckets
  31. 31. Tips - Declare connection pools outside of the handler’s scope - Write tests! - Test locally - the only error you should be expecting is IAM Permissions error. <role> is not authorized to perform: <operation> on resource: <resource> - Do not create Microliths - Set up billing alerts
  32. 32. Tips - Pick the best tool for the job - Do not pick the tool and try to fit the job into it - Beware of the shiny object syndrome - Take measured risks - Production is (mostly) unforgiving
  33. 33. “You’re free to choose, but you’re not free from the consequences of your choice” - Universal Paradox
  34. 34. Fin Manish Pandit Director of Platform Engineering @marqeta @lobster1234