SlideShare a Scribd company logo
Serverless Design Patterns
NDev Meetup 11/2018
Intro
• Currently freelance software
engineer and architect

• Former AWS

• API Gateway, Lambda

• Prev: Verafin, D2L

• MUN Comp Eng 2007
NDev Talk - Serverless Design Patterns
NDev Talk - Serverless Design Patterns
Building with serverless is
awesome and easy!
… but awkward at first
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!)
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
FaaS
• (Stateless) Functions as a Service

• AWS Lambda

• Azure Functions

• Google Cloud Functions

• Auth0 WebTask

• etc.
Other serverless services
• AWS

• S3

• DynamoDB*

• Cognito

• API Gateway

• Aurora

• …
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
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
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
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
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
https://mikhail.io
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
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
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)
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
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/
Patterns
• Adoption patterns

• New services built using serverless

• Async components outside of critical path

• Lift-and-shift entire application into Lambda
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
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
Demo
Live App: https://goo.gl/9GY89C
Demo
$ git clone git@github.com:rpgreen/ndevdemo.git
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)
Thanks!
@ryangtweets 

https://ryang.ca 

ryang@ryang.ca

More Related Content

PDF
Serverless Framework (2018)
PPTX
Sas 2015 event_driven
PPTX
How Serverless Changes DevOps
PPT
DevOpsCon Cloud Workshop
PDF
Intro to Serverless
PPTX
Greetings from AWS User Group Taiwan
PPTX
104 meets cloud
PPTX
Microservices in Azure
Serverless Framework (2018)
Sas 2015 event_driven
How Serverless Changes DevOps
DevOpsCon Cloud Workshop
Intro to Serverless
Greetings from AWS User Group Taiwan
104 meets cloud
Microservices in Azure

What's hot (20)

PPTX
Serverless Patterns
PDF
Serverless Systems: The Future is Here
PPTX
Azure functions
PPTX
IT Talk «Microservices & Serverless Architectures», Alexander Chichenin (Solu...
PPTX
Serverless with Azure Functions
PPTX
Container Management with Amazon ECS
PPTX
Campus days Azure HDInsight automation
PDF
Intro To Serverless ClojureScript
PDF
Cloudsolutionday 2016: DevOps workflow with Docker on AWS
PDF
Switching SaaS Hosting From dedicated virtual machines to container-based clu...
PDF
Project Sherpa: How RightScale Went All in on Docker
PPTX
Meetup #3: Migrate a fast scale system to AWS
PPT
Stacktician - CloudStack Collab Conference 2014
PPTX
Containerization: The DevOps Revolution
PDF
Fuse integration-services
PPTX
Azure Functions Real World Examples
PDF
Accelerating DevOps Pipelines with AWS
PDF
Inrastructure as Code
PDF
Python in the Serverless Era (PyCon IL 2016)
PPTX
Brisbane DevOps Meetup - Reinvent 2015
Serverless Patterns
Serverless Systems: The Future is Here
Azure functions
IT Talk «Microservices & Serverless Architectures», Alexander Chichenin (Solu...
Serverless with Azure Functions
Container Management with Amazon ECS
Campus days Azure HDInsight automation
Intro To Serverless ClojureScript
Cloudsolutionday 2016: DevOps workflow with Docker on AWS
Switching SaaS Hosting From dedicated virtual machines to container-based clu...
Project Sherpa: How RightScale Went All in on Docker
Meetup #3: Migrate a fast scale system to AWS
Stacktician - CloudStack Collab Conference 2014
Containerization: The DevOps Revolution
Fuse integration-services
Azure Functions Real World Examples
Accelerating DevOps Pipelines with AWS
Inrastructure as Code
Python in the Serverless Era (PyCon IL 2016)
Brisbane DevOps Meetup - Reinvent 2015
Ad

Similar to NDev Talk - Serverless Design Patterns (20)

PPTX
Primeros pasos en desarrollo serverless
PDF
Serverless Toronto User Group - Let's go Serverless!
PPTX
Understanding serverless architecture
PDF
Introduction to Serverless through Architectural Patterns
PDF
Skillenza Build with Serverless Challenge - Advanced Serverless Concepts
PDF
Montréal AWS Users United: Let's go Serverless!
PDF
20180111 we bde-bs - serverless url shortener
PDF
Serverless: A love hate relationship
PDF
The future will be Serverless - JSDay Verona 2018
PDF
Dhaval Nagar - ServerlessDays Bengaluru 2023
PDF
Microservices and Serverless for Mega Startups - DevOps IL Meetup
PDF
Jumpstart your idea with AWS Serverless [Oct 2020]
PPTX
What is Serverless Computing?
PDF
Serverless Architectural Patterns & Best Practices
PDF
The future will be Serverless (FrontConf Munich 2017)
PDF
2022 Presentation | Serverless Innovation with AWS
PDF
Serverless Node.js
PDF
Čtvrtkon #64 - AWS Serverless - Michal Haták
PDF
Learning Serverless Design Develop and Deploy with Confidence 1st Edition Jas...
PDF
Serverless use cases with AWS Lambda
Primeros pasos en desarrollo serverless
Serverless Toronto User Group - Let's go Serverless!
Understanding serverless architecture
Introduction to Serverless through Architectural Patterns
Skillenza Build with Serverless Challenge - Advanced Serverless Concepts
Montréal AWS Users United: Let's go Serverless!
20180111 we bde-bs - serverless url shortener
Serverless: A love hate relationship
The future will be Serverless - JSDay Verona 2018
Dhaval Nagar - ServerlessDays Bengaluru 2023
Microservices and Serverless for Mega Startups - DevOps IL Meetup
Jumpstart your idea with AWS Serverless [Oct 2020]
What is Serverless Computing?
Serverless Architectural Patterns & Best Practices
The future will be Serverless (FrontConf Munich 2017)
2022 Presentation | Serverless Innovation with AWS
Serverless Node.js
Čtvrtkon #64 - AWS Serverless - Michal Haták
Learning Serverless Design Develop and Deploy with Confidence 1st Edition Jas...
Serverless use cases with AWS Lambda
Ad

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Advanced Soft Computing BINUS July 2025.pdf
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Big Data Technologies - Introduction.pptx
PDF
Advanced IT Governance
PDF
Approach and Philosophy of On baking technology
PDF
Electronic commerce courselecture one. Pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Cloud computing and distributed systems.
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
cuic standard and advanced reporting.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
MYSQL Presentation for SQL database connectivity
Reach Out and Touch Someone: Haptics and Empathic Computing
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Advanced Soft Computing BINUS July 2025.pdf
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Big Data Technologies - Introduction.pptx
Advanced IT Governance
Approach and Philosophy of On baking technology
Electronic commerce courselecture one. Pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
20250228 LYD VKU AI Blended-Learning.pptx
The AUB Centre for AI in Media Proposal.docx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Cloud computing and distributed systems.
Network Security Unit 5.pdf for BCA BBA.
cuic standard and advanced reporting.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025

NDev Talk - Serverless Design Patterns

  • 2. Intro • Currently freelance software engineer and architect • Former AWS • API Gateway, Lambda • Prev: Verafin, D2L • MUN Comp Eng 2007
  • 5. Building with serverless is awesome and easy! … but awkward at first
  • 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.
  • 9. Other serverless services • AWS • S3 • DynamoDB* • Cognito • API Gateway • Aurora • …
  • 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
  • 25. Demo $ git clone git@github.com:rpgreen/ndevdemo.git
  • 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)