4. No servers to provision
or manage
Scales with usage
Never pay for idle Availability and
fault-tolerance built in
Serverless means…
5. SERVICES (ANYTHING)
Changes in
data state
Requests to
endpoints
Changes in
resource state
EVENT SOURCE FUNCTION
Node.js
Python
Java
C#
Go
Serverless applications
New
6. Common serverless use cases
Web
applications
• Static
websites
• Complex web
apps
• Packages for
Flask and
Express
Data
processing
• Real-time
• MapReduce
• Batch
Chatbots
• Powering
chatbot logic
Backends
• Apps and
services
• Mobile
• IoT
</></>
Amazon
Alexa
• Powering
voice-enabled
apps
• Alexa Skills
Kit
IT
automation
• Policy engines
• Extending
AWS services
• Infrastructure
management
9. Fannie Mae Serverless Financial Modeling
Financial Modeling is a Monte-Carlo simulation process to project future cash flows,
which is used for managing the mortgage risk on daily basis:
• Underwriting and valuation
• Risk management
• Financial reporting
• Loss mitigation and loan removal
• ~10 Quadrillion (10#10$%) of cash flow
projections each month in hundreds
of economic scenarios.
• One simulation run of ~ 20 million
mortgages takes 1.4 hours, >4 times
faster than the existing process.
Federal National Mortgage Association
The Federal National Mortgage Association
Case
Study
10. • PhotoVogue is an online photography platform. Launched in
2011 and part of Vogue Italia - which is owned by Condé Nast
Italia - it allows upcoming photographers to showcase their work.
• Amazon S3, AWS Lambda, Amazon API Gateway, Amazon CloudFront
• The Benefits
• Quicker provisioning, from days to hours
• 90% faster
• Cut IT costs by around 30%
• Seamless scalability
Case
Study
11. Fine-grained pricing
Buy compute time in 100-ms increments
Low request charge
No hourly, daily, or monthly minimums
No per-device fees
Never pay for idle
Free Tier
1 M requests and 400,000 GB-s of compute
Every month, every customer
12. SMART RESOURCE ALLOCATION
Match resource allocation (up to 3 GB) to logic
Stats for Lambda function that calculates 1000 times all prime
numbers <= 1000000
128 MB 11.722965 sec $0.024628
256 MB 6.678945 sec $0.028035
512 MB 3.194954 sec $0.026830
1024 MB 1.465984 sec $0.024638
13. Amazon S3 Amazon
DynamoDB
Amazon
Kinesis
AWS
CloudFormation
AWS CloudTrail Amazon
CloudWatch
Amazon
Cognito
Amazon SNSAmazon
SES
Cron events
DATA STORES ENDPOINTS
DEVELOPMENT AND MANAGEMENT TOOLS EVENT/MESSAGE SERVICES
Event sources that trigger AWS Lambda
…and more!
AWS
CodeCommit
Amazon
API Gateway
Amazon
Alexa
AWS IoT AWS Step
Functions
14. 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
15. Lambda permissions model
Fine-grained security controls for both
execution and invocation
Execution policies:
• Define what AWS resources/API calls this
function can access via IAM
• Used in streaming invocations
• For example, "Lambda function A can read
from DynamoDB table users"
Function policies:
• Used for sync and async invocations
• For example, "Actions on bucket X can invoke
Lambda function Z"
• Resource policies allow for cross-account
access
16. Amazon API Gateway
Internet
Mobile Apps
Websites
Services
AWS Lambda
functions
AWS
All private (VPC) or
publicly accessible
endpoints
Amazon
CloudWatch
Monitoring
Amazon
CloudFront
Any other
AWS service
Endpoints on
Amazon EC2
AWS Step
Functions
17. Create a unified
API front end for
multiple
microservices
Authenticate and
authorize
requests to a
backend
DDoS protection
and throttling for
your backend
Throttle, meter,
and monetize API
usage by third-
party developers
Amazon API Gateway
18. Amazon API Gateway – Lambda Proxy Integration
{
"resource": "Resource path",
"path": "Path parameter",
"httpMethod": "Incoming request's method name",
"headers": {Incoming request headers},
"queryStringParameters": {Query string parameters},
"pathParameters":{Path parameters},
"stageVariables": {Applicable stage variables},
"requestContext": {Request context, including authorizer-returned key-value pairs},
"body": "...",
"isBase64Encoded": true|false
}
{
"statusCode": httpStatusCode,
"headers": { "headerName": "headerValue", ... },
"body": "...”,
"isBase64Encoded": true|false
}
Input Format of a Lambda Function for Proxy Integration
Output Format of a Lambda Function for Proxy Integration
19. Infrastructure as Code
AWS CloudFormation
Provision and manage a collection of related AWS resources.
Your application = CloudFormation stack
Input .yaml file and output provisioned AWS resources
31. Safe deployments baked into SAM!
Lambda aliases now enable traffic shifting
CodeDeploy integration for deployment automation
Deployment automation natively supported in SAM
New
32. Safe deployments baked into SAM!
Version – immutable deployment unit
Alias – pointer to a version
Lambda Function Foo:
Alias "Live" - Version 5
- Version 6- Version 75%
95%
New
38. Takeaways
• Think Event-Driven
• Event Sourcing
• Real-Time Analytics
• Manage your Infrastructure as Code
• AWS Serverless Application Model (SAM) & AWS CloudFormation
• Apply Software Development Best Practices to Manage the Evolution of
your Architecture
• Use Safe Deployments in Production
• Canary/Linear Deployments
• Alarms & Hooks to Monitor Your Business Metrics
• Build Your CI/CD Pipeline to Speed Up Your Feedback Cycle
• AWS CLI + SAM + Your Favorite Tool
• AWS CodePipeline + CodeBuild + CodeStar