6. A Brief History of Cloud
Compute…
• Pre-2008: The dark ages: on-prem, hardware, VMWare
• 2008: VMs on EC2 (IaaS)
• 2011: Elastic Beanstalk (PaaS)
• 2014: AWS Lambda (BaaS, FaaS)
• 2015: Elastic Container Service
• 2017: Fargate, EKS
• 2018+: ??? (Re:Invent is tomorrow!)
7. Serverless?
• What does it even mean?
• Generally accepted properties:
• Uses fully-managed cloud services
• Pay-per-use (i.e. request). “Don’t pay for idle”
• Auto-scales
• Servers/hardware/OS, and potentially
runtimes, are abstracted
• Concept predates the term (2014)
• i.e. S3 (2006) meets the definition of
serverless
8. FaaS
• (Stateless) Functions as a Service
• AWS Lambda
• Azure Functions
• Google Cloud Functions
• Auth0 WebTask
• etc.
10. Use-cases
• Respond to events
• i.e. drop an image in S3, automatically generate a thumbnail using
Lambda
• Event sources on AWS: DynamoDB, Kinesis, SQS, S3, Cloudwatch
Events, API Gateway, etc.
• Web/mobile application backend
• REST/GraphQL API fronted by API Gateway/AppSync
• Can reuse ExpressJS, Jersey/Spring/Spark, Flask, etc.
• IoT backend
11. Use-cases
• Stream processing
• i.e. clickstreams, logs, event sourcing, etc.
• Kinesis, Kafka, etc.
• Edge computing
• CDN, Lambda@Edge i.e. re-write routing or caching rules at runtime based on user request.
• Greengrass
• Workflows
• Step Functions
• Scheduled processing
• CloudWatch events
• Alexa Apps
12. Advantages
• Automatic scaling
• Good for bursty workloads
• VMs and containers generally have very low utilization
• Automatic multi-zone redundancy for high-availability
• “Secure by default”
• Faster time and lower cost to market. Easy to do cheap
experiments
13. Advantages
• Cost
• Pay per 100ms. Free tier. Don’t pay for idle
• Simplicity
• Don't have to manage hardware, OS, patches, etc.
• Developers focus on business logic, not infra. Don’t
need “DevOps” team
• Less infra: no load balancers, VPCs, security groups, etc
14. Disadvantages
• Cold starts
• Not ideal for highly latency-sensitive use-cases (i.e. p99+)
• More $ at scale
• Dev/test
• Debugging and distributed tracing
• Impedance mismatch with web server frameworks
• Large batch processing: handling of large files or long-running processes
• Lambda 15 min timeout
• Lambda 500MB scratch disk
• If workload can’t be partitioned or made into a workflow
16. Patterns
• I want to host a website “serverlessly”
• Static assets/JS hosted in S3
bucket
• CDN and edge cache provided by
CloudFront
• Custom domain name tied to
CloudFront distribution
• HTTPS certificate for TLS
17. Patterns
• I want to host a backend for a web or mobile
application “serverlessly”
• API Gateway for REST API backend over
HTTPS
• Lambda for backend implementation
• Can use existing server-side HTTP
frameworks: Express/Jersey/Spring/Flask/
etc.
• Cognito for AuthN/AuthZ
• Datastore in DynamoDB, Aurora, RDS, custom,
etc.
• See also: AWS AppSync, Mobile BaaS
18. Patterns
• I want to process a stream of events or messages
“serverlessly”
• Event stream using Kinesis, SQS, DynamoDB
streams, Kafka, etc.
• Potentially many producers, consumers
• Event listener implemented in Lambda
• Automatically invoked with batches of events
(configurable)
• “Fan out”: invoke a separate function, or
multiple functions, per event
• Event-sourcing, “databases as cattle”, “turning the
database inside out”
• Dead Letter Queue for failures (SQS)
19. Patterns
• I want to execute a scheduled job “serverlessly”
• i.e. “serverless” cron job. Good for background
processing, asynchronous workflows
• Job implemented in AWS Lambda
• CloudWatch Event trigger with cron expression
20. Patterns
• I want to execute a complex workflow “serverlessly”
• Workflow defined in Step Functions
• State machine loops/conditions/retries/etc.
• Can include human intervention
• Can run for up to a year
• Workflow tasks implemented in AWS Lambda
• Example: https://aws.amazon.com/blogs/
compute/implementing-canary-deployments-of-
aws-lambda-functions-with-alias-traffic-shifting/
21. Patterns
• Adoption patterns
• New services built using serverless
• Async components outside of critical path
• Lift-and-shift entire application into Lambda
22. Tools
• Deployment
• AWS CLI/SDK
• SAM
• SAM Local
• Serverless
• Apex
• Chalice (Python)
• Zappa
• Test/debug
• XUnit
• SAM Local
• Tracing
• X-Ray
• Libraries
• aws-serverless-express
• JS/Node/Express
• aws-serverless-java-container
• Java/Jersey/Spring
• aws-lambda-go
• Golang
23. Demo
• Facebook Live “Like” button clone
• Patterns used
• Static web application
• Web application backend / REST API / microservice
• Stream processing
• Scheduled asynchronous processing
• Fully “infrastructure as code”, defined in SAM
26. Future
• Composable apps (Serverless Application Repository)
• Composable functions
• Custom agents and runtimes
• Serverless containers (Fargate)
• Less containers in general, far less VMs
• More framework support for FaaS
• Better tooling
• Cold start minimization
• NoCode (i.e. AppSync)