SlideShare a Scribd company logo
1 of 64
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Serverless Architectural Patterns and
Best Practices
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Intro
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What is serverless?
Build and run applications
without thinking about servers
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Let’s take a look at the evolution of computing
Physical Servers
in Datacenters
Virtual Servers
in Datacenters
Virtual Servers
in the Cloud
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Each progressive step was better
Physical Servers
Datacenters
Virtual Servers
Datacenters
• Higher utilization
• Faster provisioning speed
• Improved uptime
• Disaster recovery
• Hardware independence
• Trade CAPEX for OPEX
• More scale
• Elastic resources
• Faster speed and agility
• Reduced maintenance
• Better availability and
fault tolerance
Virtual Servers
in the Cloud
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
But there are still limitations
Physical Servers
Datacenters
Virtual Servers
Datacenters
• Trade CAPEX for OPEX
• More scale
• Elastic resources
• Faster speed and agility
• Reduced maintenance
• Better availability and
fault tolerance
• Still need to administer
virtual servers
• Still need to manage
capacity and utilization
• Still need to size
workloads
• Still need to manage
availability, fault
tolerance
• Still expensive to run
intermittent jobs
Virtual Servers
in the Cloud
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
From the Iron Age to Freedom
SERVERLESS
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
No server is easier to manage than no server
All of this
goes away
Provisioning and utilization
Availability and fault tolerance
Scaling
Operations and management
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Deliver on demand, never pay for idle
EVENT DRIVEN
CONTINUOUS SCALING PAY BY USAGE
Changes in
data state
Requests to
endpoints
Changes in
resource state
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
No servers to provision
or manage
Scales with usage
Never pay for idle Availability and fault
tolerance built in
Benefits of Lambda and serverless compute
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ON PREM
CLOUD
“LEGACY” ARCHITECTURES
(monoliths, manual deployments)
MODERN ARCHITECTURES
(Microservices, API driven, event driven)
- Change in capacity
processes
- Change in cost
models
CONTAINERS
- Change in operational processes
- Change in development models
EC2
ECS/EKS/FARGATE
EKS/ECS/FARGATE
Containers vs Serverless = Containers + Serverless
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lambda execution model
Synchronous (push) Asynchronous (event)Stream-based
Amazon
API Gateway
AWS Lambda
function
Amazon
DynamoDBAmazon
SNS
/order
AWS Lambda
function
Amazon
S3
reqs
Amazon
Kinesis
changes
AWS Lambda
service
function
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon API Gateway
API Proxy
Amazon SNS
Amazon SQS
Messaging
AWS Lambda
Compute
Amazon S3
Storage
Monitoring and Debugging
AWS X-Ray
Orchestration
AWS Step Functions
Edge Compute
AWS Greengrass
Lambda@Edge
AWS: A Mature Serverless Portfolio
Amazon Kinesis
Analytics
Amazon Athena
Amazon DynamoDB
Database
Amazon Aurora
Serverless (coming soon)
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Architectures
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Web
Applications
• Static
websites
• Complex web
apps
• Packages for
Flask and
Express
Data
Processing
• Real time
• MapReduce
• Batch
Chatbots
• Powering
chatbot logic
Backends
• Apps &
services
• Mobile
• IoT
</></>
Amazon
Alexa
• Powering
voice-enabled
apps
• Alexa Skills
Kit
Autonomous
IT
• Policy engines
• Extending
AWS services
• Infrastructure
management
Common use cases
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Web Applications and Backends
Internet
Mobile Apps
Websites
Services
AWS Lambda
function
AWS
API Gateway
Cache
All publicly
accessible
endpoints
Amazon
CloudWatch
Monitoring
Amazon
CloudFront
Amazon S3 AWS Lambda
function
AWS Lambda
function
Amazon DynamoDB
Web
Applications
• Static
websites
• Complex web
apps
• Packages for
Flask and
Express
Backends
• Apps &
services
• Mobile
• IoT
</></>
Common use cases
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Web
Applications
• Static
websites
• Complex web
apps
• Packages for
Flask and
Express
Data
Processing
• Real time
• MapReduce
• Batch
Chatbots
• Powering
chatbot logic
Backends
• Apps &
services
• Mobile
• IoT
</></>
Amazon
Alexa
• Powering
voice-enabled
apps
• Alexa Skills
Kit
Autonomous
IT
• Policy engines
• Extending
AWS services
• Infrastructure
management
Data processing: Lambda + S3
Common use cases
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Data
Processing
• Real time
• MapReduce
• Batch
Data processing: Lambda + Kinesis
Common use cases
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Data
Processing
• Real time
• MapReduce
• Batch
Data processing: Lambda + Dynamo DB
Common use cases
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Web
Applications
• Static
websites
• Complex web
apps
• Packages for
Flask and
Express
Data
Processing
• Real time
• MapReduce
• Batch
Chatbots
• Powering
chatbot logic
Backends
• Apps &
services
• Mobile
• IoT
</></>
Amazon
Alexa
• Powering
voice-enabled
apps
• Alexa Skills
Kit
Autonomous
IT
• Policy engines
• Extending
AWS services
• Infrastructure
management
Common use cases
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Web
Applications
• Static
websites
• Complex web
apps
• Packages for
Flask and
Express
Data
Processing
• Real time
• MapReduce
• Batch
Chatbots
• Powering
chatbot logic
Backends
• Apps &
services
• Mobile
• IoT
</></>
Amazon
Alexa
• Powering
voice-enabled
apps
• Alexa Skills
Kit
Autonomous
IT
• Policy engines
• Extending
AWS services
• Infrastructure
management
Common use cases
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How does serverless look like in
production?
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Serverless Microservice
S3
CloudFront
Static
Content
Content
Delivery
API
Layer
Application
Layer
Persistency
Layer
API
Gateway
DynamoDBAWS
Lambda
Authentication
Authorization
Cognito
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Demo
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Serverless Microservice
S3
CloudFront
Static
Content
Content
Delivery
API
Layer
Application
Layer
Persistency
Layer
API
Gateway
DynamoDBAWS
Lambda
Authentication
Authorization
Cognito
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Serverless Microservice
S3
CloudFront
Static
Content
Content
Delivery
API
Layer
Application
Layer
Persistency
Layer
API
Gateway
DynamoDBAWS
Lambda
Authentication
Authorization
Cognito
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
170 Lambda
functions in prod
1.2 GB deployment
packages in prod
95% cost saving vs
EC2
15x no. of prod
releases per month
Expanded to add
analytics, ratings,
people search
It’s a new world, a new day, a new life..
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Design principles for Serverless
applications
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
General design principles
Speedy, simple, singular
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Instead of Lambda based “monoliths”….
GET /pets
PUT /pets
DELETE /pets
GET /describe/pet/$id
PUT /describe/pet/$id
ONE LARGE LAMBDA FUNCTIONEVENT DRIVEN
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lambda based “nano-services”
EVENT DRIVEN Constellation of functions
GET /pets
PUT /pets
DELETE /pets
GET /describe/pet/$id
PUT /describe/pet/$id
Amazon
API Gateway
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
General design principles
Think concurrent requests, not
total requests
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Computer power
Lambda exposes only a memory control, this also affects the #
of ECUs allocated to a function
Is your code CPU, Network or memory-bound, it could be
cheaper to give more memory
> Memory > Cores
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lambda function runtimes
Icon made by Freepik from www.flaticon.com
Separate business logic from function signature
Choose dependencies/frameworks carefully
Interpret languages initialize much quicker but not
necessarily faster overall
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Compute power: Don’t “guesstimate”
alexcasalboni
aws-lambda-power-tuning
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
General design principles
Share nothing
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Leverage container reuse but persistent storage for durable
state
s3 = boto3.resource('s3')
db = db.connect()
def lambda_handler(event, context):
global db
# verify if still connected
# otherwise carry on
if not db:
db = db.connect()
…
db.save(highly_durable_state)
...
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
General design principles
Assume no hardware affinity
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
General design principles
Orchestrate your application with
state machines, not functions
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Don’t orchestrate within your functions…STARTJOB
JOB#XSTARTED
HTTPPOST
HTTPPOST
AREWETHEREYET?
NOPE!
WE’REDONE!
ZzZz
OR
time.sleep(10)
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Step Functions with AWS Batch
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
General design principles
Use events to trigger transactions
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
General design principles
Design for failures and duplicates
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Applying Saga pattern with AWS Step Functions
theburningmonk.com/2017/07/applying-the-saga-pattern-with-aws-lambda-and-step-functions
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Best practices
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
API Gateway > Lambda Best Practices
• Global level throttling and Authorization are minimum baseline
• Maximum timeout is 30 seconds - If it’s timing out consider reviewing
• Another option is to use AWS Step Functions to orchestrate a more complex
processing
• If longer wait is unusual have Front-end to halt request then retry
• Service Proxy when suitable == Unnecessary calls to Lambda
Calls orchestrations == Step Functions
Inter-service communication == API GW || Async Lambda Invoke
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Async Best Practices
• One DLQ per function – SQS or SNS
• When unable to send error to configured DLQ, DLQ Errors metric will be updated
• Duplicates may happen; code must be idempotent
• Understand retries and limitations for each Lambda Event Source
used
• Not all services support cross-account invocation; always refer to docs
• Enable SNS Delivery Status to ensure visibility on success/failure
rates
• Cloudwatch Metric Filter can aid create custom metrics out of pattern here
• Leverage Cloudwatch Events for scheduled calls
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Deployment
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Deployment best practices
• Single responsibility principle == Single function
• Share resource information across stacks via Export
value or SSM Parameter Store
• Build out multiple environments, such as for
Development, Test, Production and even DR using
the same template, even across accounts
• Shared code == Language specific packages
Shared Event Source == Same template
SAM Template
Source
Control
Dev
Test
Prod
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Testing
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Testing strategies
Run Unit tests locally
Run Integration/Acceptance tests with real services
Leverage SAM Local and Lambda runtime AMI
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Local development with SAM Local (Beta)
Test functions locally via Docker containers
Run API Gateway locally with hot-reloading
Validate SAM templates
Support for remote debugging
https://github.com/awslabs/serverless-application-model
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monitoring
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Cloudwatch – Metrics and streaming
Alarm on individual and aggregate metrics
(Throttling alarm !== Errors/Duration alarm)
Create Custom Metrics via Metric Filter
(Centralize logs from multiple accounts to Amazon ES)
Drill down application insights with X-Ray
(Too much time spent at logs == Lack of metrics)
Log only what’s necessary
(Use Environment Variables to control logging level)
built-in custom
Amazon Cloudwatch
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
X-Ray – Application Insights
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Application instrumentation (Node.js)
const AWSXRay = require('aws-xray-sdk-core');
# Wraps AWS SDK and trace subsequent AWS Services
const AWS = AWSXRay.captureAWS(require('aws-sdk'));
const dynamoDb = new AWS.DynamoDB.DocumentClient();
const sqs = new AWS.SQS();
# Wraps HTTP calls made
const https = AWSXRay.captureHTTPs(require('https'));
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Security
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Vulnerabilities and security scan
Application Security Best practices still apply
(Input validation/sanitization, code review, etc..)
One IAM Role per function
(permissions are easy to add but hard to remove)
Encrypt secrets with KMS integration
(Leverage EC2 SSM Parameter Store for shared secrets)
Automate security scans/controls into CI/CD
(Dependency CVEs, static/dynamic analysis, etc.)
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Resources
- AWS Lambda Resources https://aws.amazon.com/lambda/resources/
- 10 lessons from 10 years of AWS https://t.co/uny0wPz3o6
- Serverless Architectures with AWS Lambda https://bit.ly/2zVvp0w
- Optimizing Enterprise Economics with Serverless Architectures
https://bit.ly/2hQdy44
- Serverless Application Lens AWS Well-Architected Framework
http://bit.ly/2ALmKdz
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Next steps
• See https://aws.amazon.com/serverless for reference architectures,
samples, and links to more content!
• Explore the AWS SAM specification on GitHub
• Visit the Lambda console, download a blueprint, and get started building
your own Serverless Applications
• Send us your questions, comments, and feedback on the AWS Lambda
Forums.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you

More Related Content

What's hot

Optimize Amazon EC2 for Fun and Profit
Optimize Amazon EC2 for Fun and Profit Optimize Amazon EC2 for Fun and Profit
Optimize Amazon EC2 for Fun and Profit Amazon Web Services
 
Build Intelligent Apps with Amazon ML
Build Intelligent Apps with Amazon ML Build Intelligent Apps with Amazon ML
Build Intelligent Apps with Amazon ML Amazon Web Services
 
Serverless Architectural Patterns I AWS Dev Day 2018
Serverless Architectural Patterns I AWS Dev Day 2018Serverless Architectural Patterns I AWS Dev Day 2018
Serverless Architectural Patterns I AWS Dev Day 2018AWS Germany
 
Enable Your Marketing Teams to Engage Users with Relevant & Personalized Cont...
Enable Your Marketing Teams to Engage Users with Relevant & Personalized Cont...Enable Your Marketing Teams to Engage Users with Relevant & Personalized Cont...
Enable Your Marketing Teams to Engage Users with Relevant & Personalized Cont...Amazon Web Services
 
Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...
Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...
Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...Amazon Web Services
 
Get the Most out of Your Elastic Load Balancer for Different Workloads (NET31...
Get the Most out of Your Elastic Load Balancer for Different Workloads (NET31...Get the Most out of Your Elastic Load Balancer for Different Workloads (NET31...
Get the Most out of Your Elastic Load Balancer for Different Workloads (NET31...Amazon Web Services
 
Design and Implement a Serverless Media-Processing Workflow
Design and Implement a Serverless Media-Processing Workflow Design and Implement a Serverless Media-Processing Workflow
Design and Implement a Serverless Media-Processing Workflow Amazon Web Services
 
The Future of Enterprise Applications is Serverless (ENT314-R1) - AWS re:Inve...
The Future of Enterprise Applications is Serverless (ENT314-R1) - AWS re:Inve...The Future of Enterprise Applications is Serverless (ENT314-R1) - AWS re:Inve...
The Future of Enterprise Applications is Serverless (ENT314-R1) - AWS re:Inve...Amazon Web Services
 
Serverless Developer Experience I AWS Dev Day 2018
Serverless Developer Experience I AWS Dev Day 2018Serverless Developer Experience I AWS Dev Day 2018
Serverless Developer Experience I AWS Dev Day 2018AWS Germany
 
BDA303 Amazon Rekognition: Deep Learning-Based Image and Video Analysis
BDA303 Amazon Rekognition: Deep Learning-Based Image and Video AnalysisBDA303 Amazon Rekognition: Deep Learning-Based Image and Video Analysis
BDA303 Amazon Rekognition: Deep Learning-Based Image and Video AnalysisAmazon Web Services
 
SRV309 AWS Purpose-Built Database Strategy: The Right Tool for the Right Job
 SRV309 AWS Purpose-Built Database Strategy: The Right Tool for the Right Job SRV309 AWS Purpose-Built Database Strategy: The Right Tool for the Right Job
SRV309 AWS Purpose-Built Database Strategy: The Right Tool for the Right JobAmazon Web Services
 
AWS Systems Manage: Bridging Operational Models
AWS Systems Manage: Bridging Operational Models AWS Systems Manage: Bridging Operational Models
AWS Systems Manage: Bridging Operational Models Amazon Web Services
 
Policy Verification and Enforcement at Scale with AWS (SEC320) - AWS re:Inven...
Policy Verification and Enforcement at Scale with AWS (SEC320) - AWS re:Inven...Policy Verification and Enforcement at Scale with AWS (SEC320) - AWS re:Inven...
Policy Verification and Enforcement at Scale with AWS (SEC320) - AWS re:Inven...Amazon Web Services
 
Rightsizing Your Silicon Design Environment: Elastic Clusters for EDA Workloa...
Rightsizing Your Silicon Design Environment: Elastic Clusters for EDA Workloa...Rightsizing Your Silicon Design Environment: Elastic Clusters for EDA Workloa...
Rightsizing Your Silicon Design Environment: Elastic Clusters for EDA Workloa...Amazon Web Services
 
Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify
Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify
Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify Amazon Web Services
 
Building Real-time Serverless Backends with GraphQL
Building Real-time Serverless Backends with GraphQLBuilding Real-time Serverless Backends with GraphQL
Building Real-time Serverless Backends with GraphQLAmazon Web Services
 
Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...
Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...
Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...Amazon Web Services
 
Build Enterprise-Grade Serverless Apps
Build Enterprise-Grade Serverless Apps Build Enterprise-Grade Serverless Apps
Build Enterprise-Grade Serverless Apps Amazon Web Services
 

What's hot (20)

Optimize Amazon EC2 for Fun and Profit
Optimize Amazon EC2 for Fun and Profit Optimize Amazon EC2 for Fun and Profit
Optimize Amazon EC2 for Fun and Profit
 
Build Intelligent Apps with Amazon ML
Build Intelligent Apps with Amazon ML Build Intelligent Apps with Amazon ML
Build Intelligent Apps with Amazon ML
 
Serverless Architectural Patterns I AWS Dev Day 2018
Serverless Architectural Patterns I AWS Dev Day 2018Serverless Architectural Patterns I AWS Dev Day 2018
Serverless Architectural Patterns I AWS Dev Day 2018
 
Enable Your Marketing Teams to Engage Users with Relevant & Personalized Cont...
Enable Your Marketing Teams to Engage Users with Relevant & Personalized Cont...Enable Your Marketing Teams to Engage Users with Relevant & Personalized Cont...
Enable Your Marketing Teams to Engage Users with Relevant & Personalized Cont...
 
Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...
Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...
Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...
 
Get the Most out of Your Elastic Load Balancer for Different Workloads (NET31...
Get the Most out of Your Elastic Load Balancer for Different Workloads (NET31...Get the Most out of Your Elastic Load Balancer for Different Workloads (NET31...
Get the Most out of Your Elastic Load Balancer for Different Workloads (NET31...
 
Design and Implement a Serverless Media-Processing Workflow
Design and Implement a Serverless Media-Processing Workflow Design and Implement a Serverless Media-Processing Workflow
Design and Implement a Serverless Media-Processing Workflow
 
The Future of Enterprise Applications is Serverless (ENT314-R1) - AWS re:Inve...
The Future of Enterprise Applications is Serverless (ENT314-R1) - AWS re:Inve...The Future of Enterprise Applications is Serverless (ENT314-R1) - AWS re:Inve...
The Future of Enterprise Applications is Serverless (ENT314-R1) - AWS re:Inve...
 
Serverless Developer Experience I AWS Dev Day 2018
Serverless Developer Experience I AWS Dev Day 2018Serverless Developer Experience I AWS Dev Day 2018
Serverless Developer Experience I AWS Dev Day 2018
 
BDA303 Amazon Rekognition: Deep Learning-Based Image and Video Analysis
BDA303 Amazon Rekognition: Deep Learning-Based Image and Video AnalysisBDA303 Amazon Rekognition: Deep Learning-Based Image and Video Analysis
BDA303 Amazon Rekognition: Deep Learning-Based Image and Video Analysis
 
SRV309 AWS Purpose-Built Database Strategy: The Right Tool for the Right Job
 SRV309 AWS Purpose-Built Database Strategy: The Right Tool for the Right Job SRV309 AWS Purpose-Built Database Strategy: The Right Tool for the Right Job
SRV309 AWS Purpose-Built Database Strategy: The Right Tool for the Right Job
 
AWS Systems Manage: Bridging Operational Models
AWS Systems Manage: Bridging Operational Models AWS Systems Manage: Bridging Operational Models
AWS Systems Manage: Bridging Operational Models
 
Policy Verification and Enforcement at Scale with AWS (SEC320) - AWS re:Inven...
Policy Verification and Enforcement at Scale with AWS (SEC320) - AWS re:Inven...Policy Verification and Enforcement at Scale with AWS (SEC320) - AWS re:Inven...
Policy Verification and Enforcement at Scale with AWS (SEC320) - AWS re:Inven...
 
Rightsizing Your Silicon Design Environment: Elastic Clusters for EDA Workloa...
Rightsizing Your Silicon Design Environment: Elastic Clusters for EDA Workloa...Rightsizing Your Silicon Design Environment: Elastic Clusters for EDA Workloa...
Rightsizing Your Silicon Design Environment: Elastic Clusters for EDA Workloa...
 
Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify
Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify
Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify
 
Building Real-time Serverless Backends with GraphQL
Building Real-time Serverless Backends with GraphQLBuilding Real-time Serverless Backends with GraphQL
Building Real-time Serverless Backends with GraphQL
 
Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...
Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...
Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...
 
Build Enterprise-Grade Serverless Apps
Build Enterprise-Grade Serverless Apps Build Enterprise-Grade Serverless Apps
Build Enterprise-Grade Serverless Apps
 
Bring Alexa to Work
Bring Alexa to Work Bring Alexa to Work
Bring Alexa to Work
 
Taking Serverless to the Edge
Taking Serverless to the Edge Taking Serverless to the Edge
Taking Serverless to the Edge
 

Similar to Serverless Architectural Patterns and Best Practices

Introduction to Serverless computing and AWS Lambda - Floor28
Introduction to Serverless computing and AWS Lambda - Floor28Introduction to Serverless computing and AWS Lambda - Floor28
Introduction to Serverless computing and AWS Lambda - Floor28Boaz Ziniman
 
Introduction to Serverless computing and AWS Lambda | AWS Floor28
Introduction to Serverless computing and AWS Lambda | AWS Floor28Introduction to Serverless computing and AWS Lambda | AWS Floor28
Introduction to Serverless computing and AWS Lambda | AWS Floor28Amazon Web Services
 
Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...
Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...
Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...Amazon Web Services
 
The Serverless Tidal Wave - SwampUP 2018 Keynote
The Serverless Tidal Wave - SwampUP 2018 KeynoteThe Serverless Tidal Wave - SwampUP 2018 Keynote
The Serverless Tidal Wave - SwampUP 2018 KeynoteArun Gupta
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesAmazon Web Services
 
Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...
Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...
Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...Amazon Web Services
 
Introduction to Serverless on AWS - Builders Day Jerusalem
Introduction to Serverless on AWS - Builders Day JerusalemIntroduction to Serverless on AWS - Builders Day Jerusalem
Introduction to Serverless on AWS - Builders Day JerusalemAmazon Web Services
 
How can your business benefit from going Serverless
How can your business benefit from going ServerlessHow can your business benefit from going Serverless
How can your business benefit from going ServerlessAmazon Web Services
 
Building Serverless IoT solutions - EPAM SEC 2018 Minsk
Building Serverless IoT solutions - EPAM SEC 2018 MinskBuilding Serverless IoT solutions - EPAM SEC 2018 Minsk
Building Serverless IoT solutions - EPAM SEC 2018 MinskBoaz Ziniman
 
How can your business benefit from going serverless?
How can your business benefit from going serverless?How can your business benefit from going serverless?
How can your business benefit from going serverless?Adrian Hornsby
 
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...Amazon Web Services
 
Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to ServerlessSteven Bryen
 
AWS Lambda use cases and best practices - Builders Day Israel
AWS Lambda use cases and best practices - Builders Day IsraelAWS Lambda use cases and best practices - Builders Day Israel
AWS Lambda use cases and best practices - Builders Day IsraelAmazon Web Services
 
Serverless Architectural Patterns
Serverless Architectural PatternsServerless Architectural Patterns
Serverless Architectural PatternsAmazon Web Services
 
Wildrydes Serverless Workshop Tel Aviv
Wildrydes Serverless Workshop Tel AvivWildrydes Serverless Workshop Tel Aviv
Wildrydes Serverless Workshop Tel AvivBoaz Ziniman
 
Accelerate Business Innovation Using AWS Serverless Technologies - AWS Summit...
Accelerate Business Innovation Using AWS Serverless Technologies - AWS Summit...Accelerate Business Innovation Using AWS Serverless Technologies - AWS Summit...
Accelerate Business Innovation Using AWS Serverless Technologies - AWS Summit...Amazon Web Services
 
Coordinating Microservices with AWS Step Functions.pdf
Coordinating Microservices with AWS Step Functions.pdfCoordinating Microservices with AWS Step Functions.pdf
Coordinating Microservices with AWS Step Functions.pdfAmazon Web Services
 
Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018
Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018
Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018Amazon Web Services
 
Application Modernization using the Strangler Pattern
Application Modernization using the Strangler PatternApplication Modernization using the Strangler Pattern
Application Modernization using the Strangler PatternTom Laszewski
 

Similar to Serverless Architectural Patterns and Best Practices (20)

Introduction to Serverless computing and AWS Lambda - Floor28
Introduction to Serverless computing and AWS Lambda - Floor28Introduction to Serverless computing and AWS Lambda - Floor28
Introduction to Serverless computing and AWS Lambda - Floor28
 
Introduction to Serverless computing and AWS Lambda | AWS Floor28
Introduction to Serverless computing and AWS Lambda | AWS Floor28Introduction to Serverless computing and AWS Lambda | AWS Floor28
Introduction to Serverless computing and AWS Lambda | AWS Floor28
 
Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...
Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...
Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...
 
The Serverless Tidal Wave - SwampUP 2018 Keynote
The Serverless Tidal Wave - SwampUP 2018 KeynoteThe Serverless Tidal Wave - SwampUP 2018 Keynote
The Serverless Tidal Wave - SwampUP 2018 Keynote
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 
Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...
Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...
Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...
 
Introduction to Serverless on AWS - Builders Day Jerusalem
Introduction to Serverless on AWS - Builders Day JerusalemIntroduction to Serverless on AWS - Builders Day Jerusalem
Introduction to Serverless on AWS - Builders Day Jerusalem
 
How can your business benefit from going Serverless
How can your business benefit from going ServerlessHow can your business benefit from going Serverless
How can your business benefit from going Serverless
 
Building Serverless IoT solutions - EPAM SEC 2018 Minsk
Building Serverless IoT solutions - EPAM SEC 2018 MinskBuilding Serverless IoT solutions - EPAM SEC 2018 Minsk
Building Serverless IoT solutions - EPAM SEC 2018 Minsk
 
How can your business benefit from going serverless?
How can your business benefit from going serverless?How can your business benefit from going serverless?
How can your business benefit from going serverless?
 
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...
 
Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to Serverless
 
AWS Lambda use cases and best practices - Builders Day Israel
AWS Lambda use cases and best practices - Builders Day IsraelAWS Lambda use cases and best practices - Builders Day Israel
AWS Lambda use cases and best practices - Builders Day Israel
 
Serverless Architectural Patterns
Serverless Architectural PatternsServerless Architectural Patterns
Serverless Architectural Patterns
 
Wildrydes Serverless Workshop Tel Aviv
Wildrydes Serverless Workshop Tel AvivWildrydes Serverless Workshop Tel Aviv
Wildrydes Serverless Workshop Tel Aviv
 
Accelerate Business Innovation Using AWS Serverless Technologies - AWS Summit...
Accelerate Business Innovation Using AWS Serverless Technologies - AWS Summit...Accelerate Business Innovation Using AWS Serverless Technologies - AWS Summit...
Accelerate Business Innovation Using AWS Serverless Technologies - AWS Summit...
 
Microservices for Startups
Microservices for StartupsMicroservices for Startups
Microservices for Startups
 
Coordinating Microservices with AWS Step Functions.pdf
Coordinating Microservices with AWS Step Functions.pdfCoordinating Microservices with AWS Step Functions.pdf
Coordinating Microservices with AWS Step Functions.pdf
 
Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018
Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018
Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018
 
Application Modernization using the Strangler Pattern
Application Modernization using the Strangler PatternApplication Modernization using the Strangler Pattern
Application Modernization using the Strangler Pattern
 

More from Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

More from Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Serverless Architectural Patterns and Best Practices

  • 1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Serverless Architectural Patterns and Best Practices
  • 2. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Intro
  • 3. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What is serverless? Build and run applications without thinking about servers
  • 5. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Let’s take a look at the evolution of computing Physical Servers in Datacenters Virtual Servers in Datacenters Virtual Servers in the Cloud
  • 6. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Each progressive step was better Physical Servers Datacenters Virtual Servers Datacenters • Higher utilization • Faster provisioning speed • Improved uptime • Disaster recovery • Hardware independence • Trade CAPEX for OPEX • More scale • Elastic resources • Faster speed and agility • Reduced maintenance • Better availability and fault tolerance Virtual Servers in the Cloud
  • 7. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. But there are still limitations Physical Servers Datacenters Virtual Servers Datacenters • Trade CAPEX for OPEX • More scale • Elastic resources • Faster speed and agility • Reduced maintenance • Better availability and fault tolerance • Still need to administer virtual servers • Still need to manage capacity and utilization • Still need to size workloads • Still need to manage availability, fault tolerance • Still expensive to run intermittent jobs Virtual Servers in the Cloud
  • 8. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. From the Iron Age to Freedom SERVERLESS
  • 9. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. No server is easier to manage than no server All of this goes away Provisioning and utilization Availability and fault tolerance Scaling Operations and management
  • 10. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Deliver on demand, never pay for idle EVENT DRIVEN CONTINUOUS SCALING PAY BY USAGE Changes in data state Requests to endpoints Changes in resource state
  • 11. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. No servers to provision or manage Scales with usage Never pay for idle Availability and fault tolerance built in Benefits of Lambda and serverless compute
  • 12. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ON PREM CLOUD “LEGACY” ARCHITECTURES (monoliths, manual deployments) MODERN ARCHITECTURES (Microservices, API driven, event driven) - Change in capacity processes - Change in cost models CONTAINERS - Change in operational processes - Change in development models EC2 ECS/EKS/FARGATE EKS/ECS/FARGATE Containers vs Serverless = Containers + Serverless
  • 13. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lambda execution model Synchronous (push) Asynchronous (event)Stream-based Amazon API Gateway AWS Lambda function Amazon DynamoDBAmazon SNS /order AWS Lambda function Amazon S3 reqs Amazon Kinesis changes AWS Lambda service function
  • 14. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon API Gateway API Proxy Amazon SNS Amazon SQS Messaging AWS Lambda Compute Amazon S3 Storage Monitoring and Debugging AWS X-Ray Orchestration AWS Step Functions Edge Compute AWS Greengrass Lambda@Edge AWS: A Mature Serverless Portfolio Amazon Kinesis Analytics Amazon Athena Amazon DynamoDB Database Amazon Aurora Serverless (coming soon)
  • 15. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Architectures
  • 16. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Web Applications • Static websites • Complex web apps • Packages for Flask and Express Data Processing • Real time • MapReduce • Batch Chatbots • Powering chatbot logic Backends • Apps & services • Mobile • IoT </></> Amazon Alexa • Powering voice-enabled apps • Alexa Skills Kit Autonomous IT • Policy engines • Extending AWS services • Infrastructure management Common use cases
  • 17. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Web Applications and Backends Internet Mobile Apps Websites Services AWS Lambda function AWS API Gateway Cache All publicly accessible endpoints Amazon CloudWatch Monitoring Amazon CloudFront Amazon S3 AWS Lambda function AWS Lambda function Amazon DynamoDB Web Applications • Static websites • Complex web apps • Packages for Flask and Express Backends • Apps & services • Mobile • IoT </></> Common use cases
  • 18. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Web Applications • Static websites • Complex web apps • Packages for Flask and Express Data Processing • Real time • MapReduce • Batch Chatbots • Powering chatbot logic Backends • Apps & services • Mobile • IoT </></> Amazon Alexa • Powering voice-enabled apps • Alexa Skills Kit Autonomous IT • Policy engines • Extending AWS services • Infrastructure management Data processing: Lambda + S3 Common use cases
  • 19. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Data Processing • Real time • MapReduce • Batch Data processing: Lambda + Kinesis Common use cases
  • 20. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Data Processing • Real time • MapReduce • Batch Data processing: Lambda + Dynamo DB Common use cases
  • 21. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Web Applications • Static websites • Complex web apps • Packages for Flask and Express Data Processing • Real time • MapReduce • Batch Chatbots • Powering chatbot logic Backends • Apps & services • Mobile • IoT </></> Amazon Alexa • Powering voice-enabled apps • Alexa Skills Kit Autonomous IT • Policy engines • Extending AWS services • Infrastructure management Common use cases
  • 22. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Web Applications • Static websites • Complex web apps • Packages for Flask and Express Data Processing • Real time • MapReduce • Batch Chatbots • Powering chatbot logic Backends • Apps & services • Mobile • IoT </></> Amazon Alexa • Powering voice-enabled apps • Alexa Skills Kit Autonomous IT • Policy engines • Extending AWS services • Infrastructure management Common use cases
  • 23. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. How does serverless look like in production?
  • 24. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Serverless Microservice S3 CloudFront Static Content Content Delivery API Layer Application Layer Persistency Layer API Gateway DynamoDBAWS Lambda Authentication Authorization Cognito
  • 25. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Demo
  • 26. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Serverless Microservice S3 CloudFront Static Content Content Delivery API Layer Application Layer Persistency Layer API Gateway DynamoDBAWS Lambda Authentication Authorization Cognito
  • 27. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Serverless Microservice S3 CloudFront Static Content Content Delivery API Layer Application Layer Persistency Layer API Gateway DynamoDBAWS Lambda Authentication Authorization Cognito
  • 28. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 170 Lambda functions in prod 1.2 GB deployment packages in prod 95% cost saving vs EC2 15x no. of prod releases per month Expanded to add analytics, ratings, people search It’s a new world, a new day, a new life..
  • 29. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Design principles for Serverless applications
  • 30. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. General design principles Speedy, simple, singular
  • 31. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Instead of Lambda based “monoliths”…. GET /pets PUT /pets DELETE /pets GET /describe/pet/$id PUT /describe/pet/$id ONE LARGE LAMBDA FUNCTIONEVENT DRIVEN
  • 32. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lambda based “nano-services” EVENT DRIVEN Constellation of functions GET /pets PUT /pets DELETE /pets GET /describe/pet/$id PUT /describe/pet/$id Amazon API Gateway
  • 33. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. General design principles Think concurrent requests, not total requests
  • 34. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Computer power Lambda exposes only a memory control, this also affects the # of ECUs allocated to a function Is your code CPU, Network or memory-bound, it could be cheaper to give more memory > Memory > Cores
  • 35. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lambda function runtimes Icon made by Freepik from www.flaticon.com Separate business logic from function signature Choose dependencies/frameworks carefully Interpret languages initialize much quicker but not necessarily faster overall
  • 36. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Compute power: Don’t “guesstimate” alexcasalboni aws-lambda-power-tuning
  • 37. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. General design principles Share nothing
  • 38. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Leverage container reuse but persistent storage for durable state s3 = boto3.resource('s3') db = db.connect() def lambda_handler(event, context): global db # verify if still connected # otherwise carry on if not db: db = db.connect() … db.save(highly_durable_state) ...
  • 39. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. General design principles Assume no hardware affinity
  • 40. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. General design principles Orchestrate your application with state machines, not functions
  • 41. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Don’t orchestrate within your functions…STARTJOB JOB#XSTARTED HTTPPOST HTTPPOST AREWETHEREYET? NOPE! WE’REDONE! ZzZz OR time.sleep(10)
  • 42. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 43. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Step Functions with AWS Batch
  • 44. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. General design principles Use events to trigger transactions
  • 45. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. General design principles Design for failures and duplicates
  • 46. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Applying Saga pattern with AWS Step Functions theburningmonk.com/2017/07/applying-the-saga-pattern-with-aws-lambda-and-step-functions
  • 47. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Best practices
  • 48. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. API Gateway > Lambda Best Practices • Global level throttling and Authorization are minimum baseline • Maximum timeout is 30 seconds - If it’s timing out consider reviewing • Another option is to use AWS Step Functions to orchestrate a more complex processing • If longer wait is unusual have Front-end to halt request then retry • Service Proxy when suitable == Unnecessary calls to Lambda Calls orchestrations == Step Functions Inter-service communication == API GW || Async Lambda Invoke
  • 49. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Async Best Practices • One DLQ per function – SQS or SNS • When unable to send error to configured DLQ, DLQ Errors metric will be updated • Duplicates may happen; code must be idempotent • Understand retries and limitations for each Lambda Event Source used • Not all services support cross-account invocation; always refer to docs • Enable SNS Delivery Status to ensure visibility on success/failure rates • Cloudwatch Metric Filter can aid create custom metrics out of pattern here • Leverage Cloudwatch Events for scheduled calls
  • 50. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Deployment
  • 51. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Deployment best practices • Single responsibility principle == Single function • Share resource information across stacks via Export value or SSM Parameter Store • Build out multiple environments, such as for Development, Test, Production and even DR using the same template, even across accounts • Shared code == Language specific packages Shared Event Source == Same template SAM Template Source Control Dev Test Prod
  • 52. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Testing
  • 53. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Testing strategies Run Unit tests locally Run Integration/Acceptance tests with real services Leverage SAM Local and Lambda runtime AMI
  • 54. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Local development with SAM Local (Beta) Test functions locally via Docker containers Run API Gateway locally with hot-reloading Validate SAM templates Support for remote debugging https://github.com/awslabs/serverless-application-model
  • 55. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monitoring
  • 56. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Cloudwatch – Metrics and streaming Alarm on individual and aggregate metrics (Throttling alarm !== Errors/Duration alarm) Create Custom Metrics via Metric Filter (Centralize logs from multiple accounts to Amazon ES) Drill down application insights with X-Ray (Too much time spent at logs == Lack of metrics) Log only what’s necessary (Use Environment Variables to control logging level) built-in custom Amazon Cloudwatch
  • 57. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. X-Ray – Application Insights
  • 58. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Application instrumentation (Node.js) const AWSXRay = require('aws-xray-sdk-core'); # Wraps AWS SDK and trace subsequent AWS Services const AWS = AWSXRay.captureAWS(require('aws-sdk')); const dynamoDb = new AWS.DynamoDB.DocumentClient(); const sqs = new AWS.SQS(); # Wraps HTTP calls made const https = AWSXRay.captureHTTPs(require('https'));
  • 59. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Security
  • 60. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 61. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Vulnerabilities and security scan Application Security Best practices still apply (Input validation/sanitization, code review, etc..) One IAM Role per function (permissions are easy to add but hard to remove) Encrypt secrets with KMS integration (Leverage EC2 SSM Parameter Store for shared secrets) Automate security scans/controls into CI/CD (Dependency CVEs, static/dynamic analysis, etc.)
  • 62. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Resources - AWS Lambda Resources https://aws.amazon.com/lambda/resources/ - 10 lessons from 10 years of AWS https://t.co/uny0wPz3o6 - Serverless Architectures with AWS Lambda https://bit.ly/2zVvp0w - Optimizing Enterprise Economics with Serverless Architectures https://bit.ly/2hQdy44 - Serverless Application Lens AWS Well-Architected Framework http://bit.ly/2ALmKdz
  • 63. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Next steps • See https://aws.amazon.com/serverless for reference architectures, samples, and links to more content! • Explore the AWS SAM specification on GitHub • Visit the Lambda console, download a blueprint, and get started building your own Serverless Applications • Send us your questions, comments, and feedback on the AWS Lambda Forums.
  • 64. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Thank you