SlideShare a Scribd company logo
1 of 39
Intro to Serverless
Application Architecture
Danilo Poccia
Evangelist, Serverless
danilop@amazon.com
@danilop
danilop
No servers to provision
or manage
Scales with usage
Never pay for idle Availability and
fault-tolerance built in
Serverless means…
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
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
Case
Study
FINRA
Case
Study
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
• 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
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
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
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
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
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
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
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
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
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
Meet
SAM!
Serverless Application Model (SAM)
CloudFormation extension optimized for serverless
New serverless resource types: functions, APIs, and tables
Supports anything CloudFormation supports
Open specification (Apache 2.0)
AWSTemplateFormatVersion: '2010-09-09’
Transform: AWS::Serverless-2016-10-31
Resources:
GetHtmlFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://demo-bucket/todo_list.zip
Handler: index.js
Runtime: nodejs6.1
Policies: AmazonDynamoDBReadOnlyAccess
Events:
GetHtml:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
SAM template
AWSTemplateFormatVersion: '2010-09-09’
Transform: AWS::Serverless-2016-10-31
Resources:
GetHtmlFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://demo-bucket/todo_list.zip
Handler: index.js
Runtime: nodejs6.1
Policies: AmazonDynamoDBReadOnlyAccess
Events:
GetHtml:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
SAM template
AWS::Lambda::Function
AWS::IAM::Role
AWS::IAM::Policy
AWS::ApiGateway::RestApi
AWS::ApiGateway::Stage
AWS::ApiGateway::Deployment
AWS::Lambda::Permission
CloudFormation template
AWSTemplateFormatVersion: '2010-09-09'
Resources:
GetHtmlFunctionGetHtmlPermissionProd:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:invokeFunction
Principal: apigateway.amazonaws.com
FunctionName:
Ref: GetHtmlFunction
SourceArn:
Fn::Sub: arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${ServerlessRestApi}/Prod/ANY/*
ServerlessRestApiProdStage:
Type: AWS::ApiGateway::Stage
Properties:
DeploymentId:
Ref: ServerlessRestApiDeployment
RestApiId:
Ref: ServerlessRestApi
StageName: Prod
ListTable:
Type: AWS::DynamoDB::Table
Properties:
ProvisionedThroughput:
WriteCapacityUnits: 5
ReadCapacityUnits: 5
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- KeyType: HASH
AttributeName: id
GetHtmlFunction:
Type: AWS::Lambda::Function
Properties:
Handler: index.gethtml
Code:
S3Bucket: flourish-demo-bucket
S3Key: todo_list.zip
Role:
Fn::GetAtt:
- GetHtmlFunctionRole
- Arn
Runtime: nodejs4.3
GetHtmlFunctionRole:
Type: AWS::IAM::Role
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AmazonDynamoDBReadOnlyAccess
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
ServerlessRestApiDeployment:
Type: AWS::ApiGateway::Deployment
Properties:
RestApiId:
Ref: ServerlessRestApi
Description: 'RestApi deployment id: 127e3fb91142ab1ddc5f5446adb094442581a90d'
StageName: Stage
GetHtmlFunctionGetHtmlPermissionTest:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:invokeFunction
Principal: apigateway.amazonaws.com
FunctionName:
Ref: GetHtmlFunction
SourceArn:
Fn::Sub: arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${ServerlessRestApi}/*/ANY/*
ServerlessRestApi:
Type: AWS::ApiGateway::RestApi
Properties:
Body:
info:
version: '1.0'
title:
Ref: AWS::StackName
paths:
"/{proxy+}":
x-amazon-apigateway-any-method:
x-amazon-apigateway-integration:
httpMethod: ANY
type: aws_proxy
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-
31/functions/${GetHtmlFunction.Arn}/invocations
CloudFormation Package/Deploy
aws cloudformation package 
--s3-bucket <BUCKET> 
--s3-prefix packages 
--template-file template.yaml 
--output-template-file output-template.json
aws cloudformation deploy 
--template-file ./output-template.json 
--stack-name <STACK> 
--capabilities CAPABILITY_IAM
Serverless by Design
Serverless by Design
https://sbd.danilop.net
https://github.com/danilop/ServerlessByDesign
Demo #1:
SAM Templates
Event
Sourcing
Real-Time
Analytics
Safe deployments baked into SAM!
Lambda aliases now enable traffic shifting
CodeDeploy integration for deployment automation
Deployment automation natively supported in SAM
New
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
Safe deployments baked into SAM!
AWSTemplateFormatVersion: '2010-09-09’
Transform: AWS::Serverless-2016-10-31
Resources:
GetHtmlFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://demo-bucket/todo_list.zip
Handler: index.js
Runtime: nodejs6.1
New
Safe deployments baked into SAM!
AWSTemplateFormatVersion: '2010-09-09’
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
AutoPublishAlias: Live
DeploymentPreference:
Type: Canary10Percent10Minutes
Resources:
GetHtmlFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://demo-bucket/todo_list.zip
Handler: index.js
Runtime: nodejs6.1
Policies: AmazonDynamoDBReadOnlyAccess
New
Safe deployments baked into SAM!
AWSTemplateFormatVersion: '2010-09-09’
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
AutoPublishAlias: Live
DeploymentPreference:
Type: Canary10Percent10Minutes
Hooks:
PreTraffic: !Ref CodeDeployHook_PreTest
PostTraffic: !Ref CodeDeployHook_PostTest
Alarms:
- !Ref DurationAlarm
- !Ref ErrorAlarm
Resources:
GetHtmlFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://demo-bucket/todo_list.zip
Handler: index.js
Runtime: nodejs6.1
Policies: AmazonDynamoDBReadOnlyAccess
New
CodeDeploy Console
Demo #2:
Safe Deployments
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
Intro to Serverless
Application Architecture
Danilo Poccia
Evangelist, Serverless
danilop@amazon.com
@danilop
danilop

More Related Content

What's hot

Machine Learning: From Notebook to Production with Amazon Sagemaker
Machine Learning: From Notebook to Production with Amazon SagemakerMachine Learning: From Notebook to Production with Amazon Sagemaker
Machine Learning: From Notebook to Production with Amazon SagemakerAmazon Web Services
 
Build and Deploy Serverless Applications with AWS SAM - SRV316 - Chicago AWS ...
Build and Deploy Serverless Applications with AWS SAM - SRV316 - Chicago AWS ...Build and Deploy Serverless Applications with AWS SAM - SRV316 - Chicago AWS ...
Build and Deploy Serverless Applications with AWS SAM - SRV316 - Chicago AWS ...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
 
Serverless Architecture Patterns
Serverless Architecture PatternsServerless Architecture Patterns
Serverless Architecture PatternsAmazon Web Services
 
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...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
 
Enabling Your Organization’s Amazon Redshift Adoption – Going from Zero to He...
Enabling Your Organization’s Amazon Redshift Adoption – Going from Zero to He...Enabling Your Organization’s Amazon Redshift Adoption – Going from Zero to He...
Enabling Your Organization’s Amazon Redshift Adoption – Going from Zero to He...Amazon Web Services
 
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...Chris Munns
 
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
 
AWS Lambda Layers, the Runtime API, & Nested Applications
AWS Lambda Layers, the Runtime API, & Nested ApplicationsAWS Lambda Layers, the Runtime API, & Nested Applications
AWS Lambda Layers, the Runtime API, & Nested ApplicationsAmazon Web Services
 
Building an AWS Greengrass Machine Learning Solution at the Edge (IOT403-R1) ...
Building an AWS Greengrass Machine Learning Solution at the Edge (IOT403-R1) ...Building an AWS Greengrass Machine Learning Solution at the Edge (IOT403-R1) ...
Building an AWS Greengrass Machine Learning Solution at the Edge (IOT403-R1) ...Amazon Web Services
 
Serverless Applications with AWS SAM
Serverless Applications with AWS SAMServerless Applications with AWS SAM
Serverless Applications with AWS SAMChris Munns
 
Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...
Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...
Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...Amazon Web Services
 
Raleigh DevDay 2017: Building serverless web applications
Raleigh DevDay 2017: Building serverless web applicationsRaleigh DevDay 2017: Building serverless web applications
Raleigh DevDay 2017: Building serverless web applicationsAmazon Web Services
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep DiveAmazon Web Services
 
Reliability of the Cloud: How AWS Achieves High Availability (ARC317-R1) - AW...
Reliability of the Cloud: How AWS Achieves High Availability (ARC317-R1) - AW...Reliability of the Cloud: How AWS Achieves High Availability (ARC317-R1) - AW...
Reliability of the Cloud: How AWS Achieves High Availability (ARC317-R1) - AW...Amazon Web Services
 
AWS Machine Learning Language Services
AWS Machine Learning Language ServicesAWS Machine Learning Language Services
AWS Machine Learning Language ServicesAmazon Web Services
 
Advanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step FunctionsAdvanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step FunctionsAmazon 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
 

What's hot (20)

Machine Learning: From Notebook to Production with Amazon Sagemaker
Machine Learning: From Notebook to Production with Amazon SagemakerMachine Learning: From Notebook to Production with Amazon Sagemaker
Machine Learning: From Notebook to Production with Amazon Sagemaker
 
Build and Deploy Serverless Applications with AWS SAM - SRV316 - Chicago AWS ...
Build and Deploy Serverless Applications with AWS SAM - SRV316 - Chicago AWS ...Build and Deploy Serverless Applications with AWS SAM - SRV316 - Chicago AWS ...
Build and Deploy Serverless Applications with AWS SAM - SRV316 - Chicago AWS ...
 
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...
 
Serverless Architecture Patterns
Serverless Architecture PatternsServerless Architecture Patterns
Serverless Architecture Patterns
 
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...
 
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
 
Enabling Your Organization’s Amazon Redshift Adoption – Going from Zero to He...
Enabling Your Organization’s Amazon Redshift Adoption – Going from Zero to He...Enabling Your Organization’s Amazon Redshift Adoption – Going from Zero to He...
Enabling Your Organization’s Amazon Redshift Adoption – Going from Zero to He...
 
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
 
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
 
AWS Lambda Layers, the Runtime API, & Nested Applications
AWS Lambda Layers, the Runtime API, & Nested ApplicationsAWS Lambda Layers, the Runtime API, & Nested Applications
AWS Lambda Layers, the Runtime API, & Nested Applications
 
Building Web Apps on AWS
Building Web Apps on AWSBuilding Web Apps on AWS
Building Web Apps on AWS
 
Building an AWS Greengrass Machine Learning Solution at the Edge (IOT403-R1) ...
Building an AWS Greengrass Machine Learning Solution at the Edge (IOT403-R1) ...Building an AWS Greengrass Machine Learning Solution at the Edge (IOT403-R1) ...
Building an AWS Greengrass Machine Learning Solution at the Edge (IOT403-R1) ...
 
Serverless Applications with AWS SAM
Serverless Applications with AWS SAMServerless Applications with AWS SAM
Serverless Applications with AWS SAM
 
Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...
Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...
Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...
 
Raleigh DevDay 2017: Building serverless web applications
Raleigh DevDay 2017: Building serverless web applicationsRaleigh DevDay 2017: Building serverless web applications
Raleigh DevDay 2017: Building serverless web applications
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep Dive
 
Reliability of the Cloud: How AWS Achieves High Availability (ARC317-R1) - AW...
Reliability of the Cloud: How AWS Achieves High Availability (ARC317-R1) - AW...Reliability of the Cloud: How AWS Achieves High Availability (ARC317-R1) - AW...
Reliability of the Cloud: How AWS Achieves High Availability (ARC317-R1) - AW...
 
AWS Machine Learning Language Services
AWS Machine Learning Language ServicesAWS Machine Learning Language Services
AWS Machine Learning Language Services
 
Advanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step FunctionsAdvanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step Functions
 
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...
 

Similar to Intro To Serverless Application Architecture: Collision 2018

Voxxed Athens 2018 - Serverless by Design
Voxxed Athens 2018 - Serverless by DesignVoxxed Athens 2018 - Serverless by Design
Voxxed Athens 2018 - Serverless by DesignVoxxed Athens
 
SRV203 Getting Started with AWS Lambda and the Serverless Cloud
SRV203 Getting Started with AWS Lambda and the Serverless CloudSRV203 Getting Started with AWS Lambda and the Serverless Cloud
SRV203 Getting Started with AWS Lambda and the Serverless CloudAmazon Web Services
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesAmazon Web Services
 
Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T...
 Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T... Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T...
Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T...Amazon Web Services
 
How to build and deploy serverless apps - AWS Summit Cape Town 2018
How to build and deploy serverless apps - AWS Summit Cape Town 2018How to build and deploy serverless apps - AWS Summit Cape Town 2018
How to build and deploy serverless apps - AWS Summit Cape Town 2018Amazon Web Services
 
Build and run applications without thinking about servers
Build and run applications without thinking about serversBuild and run applications without thinking about servers
Build and run applications without thinking about serversAmazon Web Services
 
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)Amazon Web Services
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudAmazon Web Services
 
Primeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverlessPrimeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverlessjavier ramirez
 
Raleigh DevDay 2017: Build a serverless web application in one day workshop
Raleigh DevDay 2017: Build a serverless web application in one day workshopRaleigh DevDay 2017: Build a serverless web application in one day workshop
Raleigh DevDay 2017: Build a serverless web application in one day workshopAmazon Web Services
 
Getting Started with AWS Lambda and Serverless Computing
Getting Started with AWS Lambda and Serverless ComputingGetting Started with AWS Lambda and Serverless Computing
Getting Started with AWS Lambda and Serverless ComputingAmazon Web Services
 
Getting Started with AWS Lambda and Serverless Computing
Getting Started with AWS Lambda and Serverless ComputingGetting Started with AWS Lambda and Serverless Computing
Getting Started with AWS Lambda and Serverless ComputingKristana Kane
 
SMC301 The State of Serverless Computing
SMC301 The State of Serverless ComputingSMC301 The State of Serverless Computing
SMC301 The State of Serverless ComputingAmazon Web Services
 
2016-06 - Design your api management strategy - AWS - Microservices on AWS
2016-06 - Design your api management strategy - AWS - Microservices on AWS2016-06 - Design your api management strategy - AWS - Microservices on AWS
2016-06 - Design your api management strategy - AWS - Microservices on AWSSmartWave
 
Primeros pasos con arquitecturas serverless
Primeros pasos con arquitecturas serverlessPrimeros pasos con arquitecturas serverless
Primeros pasos con arquitecturas serverlessAmazon Web Services
 
Architetture Serverless: concentrarsi sull'idea, non sull'infrastruttura
Architetture Serverless: concentrarsi sull'idea, non sull'infrastrutturaArchitetture Serverless: concentrarsi sull'idea, non sull'infrastruttura
Architetture Serverless: concentrarsi sull'idea, non sull'infrastrutturaAmazon Web Services
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudAmazon Web Services
 
Building CICD Pipelines for Serverless Applications - DevDay Austin 2017
Building CICD Pipelines for Serverless Applications - DevDay Austin 2017Building CICD Pipelines for Serverless Applications - DevDay Austin 2017
Building CICD Pipelines for Serverless Applications - DevDay Austin 2017Amazon Web Services
 
SMC305 Building CI/CD Pipelines for Serverless Applications
SMC305 Building CI/CD Pipelines for Serverless ApplicationsSMC305 Building CI/CD Pipelines for Serverless Applications
SMC305 Building CI/CD Pipelines for Serverless ApplicationsAmazon Web Services
 
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...Amazon Web Services
 

Similar to Intro To Serverless Application Architecture: Collision 2018 (20)

Voxxed Athens 2018 - Serverless by Design
Voxxed Athens 2018 - Serverless by DesignVoxxed Athens 2018 - Serverless by Design
Voxxed Athens 2018 - Serverless by Design
 
SRV203 Getting Started with AWS Lambda and the Serverless Cloud
SRV203 Getting Started with AWS Lambda and the Serverless CloudSRV203 Getting Started with AWS Lambda and the Serverless Cloud
SRV203 Getting Started with AWS Lambda and the Serverless Cloud
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 
Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T...
 Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T... Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T...
Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T...
 
How to build and deploy serverless apps - AWS Summit Cape Town 2018
How to build and deploy serverless apps - AWS Summit Cape Town 2018How to build and deploy serverless apps - AWS Summit Cape Town 2018
How to build and deploy serverless apps - AWS Summit Cape Town 2018
 
Build and run applications without thinking about servers
Build and run applications without thinking about serversBuild and run applications without thinking about servers
Build and run applications without thinking about servers
 
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Primeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverlessPrimeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverless
 
Raleigh DevDay 2017: Build a serverless web application in one day workshop
Raleigh DevDay 2017: Build a serverless web application in one day workshopRaleigh DevDay 2017: Build a serverless web application in one day workshop
Raleigh DevDay 2017: Build a serverless web application in one day workshop
 
Getting Started with AWS Lambda and Serverless Computing
Getting Started with AWS Lambda and Serverless ComputingGetting Started with AWS Lambda and Serverless Computing
Getting Started with AWS Lambda and Serverless Computing
 
Getting Started with AWS Lambda and Serverless Computing
Getting Started with AWS Lambda and Serverless ComputingGetting Started with AWS Lambda and Serverless Computing
Getting Started with AWS Lambda and Serverless Computing
 
SMC301 The State of Serverless Computing
SMC301 The State of Serverless ComputingSMC301 The State of Serverless Computing
SMC301 The State of Serverless Computing
 
2016-06 - Design your api management strategy - AWS - Microservices on AWS
2016-06 - Design your api management strategy - AWS - Microservices on AWS2016-06 - Design your api management strategy - AWS - Microservices on AWS
2016-06 - Design your api management strategy - AWS - Microservices on AWS
 
Primeros pasos con arquitecturas serverless
Primeros pasos con arquitecturas serverlessPrimeros pasos con arquitecturas serverless
Primeros pasos con arquitecturas serverless
 
Architetture Serverless: concentrarsi sull'idea, non sull'infrastruttura
Architetture Serverless: concentrarsi sull'idea, non sull'infrastrutturaArchitetture Serverless: concentrarsi sull'idea, non sull'infrastruttura
Architetture Serverless: concentrarsi sull'idea, non sull'infrastruttura
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Building CICD Pipelines for Serverless Applications - DevDay Austin 2017
Building CICD Pipelines for Serverless Applications - DevDay Austin 2017Building CICD Pipelines for Serverless Applications - DevDay Austin 2017
Building CICD Pipelines for Serverless Applications - DevDay Austin 2017
 
SMC305 Building CI/CD Pipelines for Serverless Applications
SMC305 Building CI/CD Pipelines for Serverless ApplicationsSMC305 Building CI/CD Pipelines for Serverless Applications
SMC305 Building CI/CD Pipelines for Serverless Applications
 
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
 

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
 

Intro To Serverless Application Architecture: Collision 2018

  • 1. Intro to Serverless Application Architecture Danilo Poccia Evangelist, Serverless danilop@amazon.com @danilop danilop
  • 2.
  • 3.
  • 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
  • 21. Serverless Application Model (SAM) CloudFormation extension optimized for serverless New serverless resource types: functions, APIs, and tables Supports anything CloudFormation supports Open specification (Apache 2.0)
  • 22. AWSTemplateFormatVersion: '2010-09-09’ Transform: AWS::Serverless-2016-10-31 Resources: GetHtmlFunction: Type: AWS::Serverless::Function Properties: CodeUri: s3://demo-bucket/todo_list.zip Handler: index.js Runtime: nodejs6.1 Policies: AmazonDynamoDBReadOnlyAccess Events: GetHtml: Type: Api Properties: Path: /{proxy+} Method: ANY SAM template
  • 23. AWSTemplateFormatVersion: '2010-09-09’ Transform: AWS::Serverless-2016-10-31 Resources: GetHtmlFunction: Type: AWS::Serverless::Function Properties: CodeUri: s3://demo-bucket/todo_list.zip Handler: index.js Runtime: nodejs6.1 Policies: AmazonDynamoDBReadOnlyAccess Events: GetHtml: Type: Api Properties: Path: /{proxy+} Method: ANY SAM template AWS::Lambda::Function AWS::IAM::Role AWS::IAM::Policy AWS::ApiGateway::RestApi AWS::ApiGateway::Stage AWS::ApiGateway::Deployment AWS::Lambda::Permission
  • 24. CloudFormation template AWSTemplateFormatVersion: '2010-09-09' Resources: GetHtmlFunctionGetHtmlPermissionProd: Type: AWS::Lambda::Permission Properties: Action: lambda:invokeFunction Principal: apigateway.amazonaws.com FunctionName: Ref: GetHtmlFunction SourceArn: Fn::Sub: arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${ServerlessRestApi}/Prod/ANY/* ServerlessRestApiProdStage: Type: AWS::ApiGateway::Stage Properties: DeploymentId: Ref: ServerlessRestApiDeployment RestApiId: Ref: ServerlessRestApi StageName: Prod ListTable: Type: AWS::DynamoDB::Table Properties: ProvisionedThroughput: WriteCapacityUnits: 5 ReadCapacityUnits: 5 AttributeDefinitions: - AttributeName: id AttributeType: S KeySchema: - KeyType: HASH AttributeName: id GetHtmlFunction: Type: AWS::Lambda::Function Properties: Handler: index.gethtml Code: S3Bucket: flourish-demo-bucket S3Key: todo_list.zip Role: Fn::GetAtt: - GetHtmlFunctionRole - Arn Runtime: nodejs4.3 GetHtmlFunctionRole: Type: AWS::IAM::Role ManagedPolicyArns: - arn:aws:iam::aws:policy/AmazonDynamoDBReadOnlyAccess - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole AssumeRolePolicyDocument: Version: '2012-10-17' Statement: - Action: - sts:AssumeRole Effect: Allow Principal: Service: - lambda.amazonaws.com ServerlessRestApiDeployment: Type: AWS::ApiGateway::Deployment Properties: RestApiId: Ref: ServerlessRestApi Description: 'RestApi deployment id: 127e3fb91142ab1ddc5f5446adb094442581a90d' StageName: Stage GetHtmlFunctionGetHtmlPermissionTest: Type: AWS::Lambda::Permission Properties: Action: lambda:invokeFunction Principal: apigateway.amazonaws.com FunctionName: Ref: GetHtmlFunction SourceArn: Fn::Sub: arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${ServerlessRestApi}/*/ANY/* ServerlessRestApi: Type: AWS::ApiGateway::RestApi Properties: Body: info: version: '1.0' title: Ref: AWS::StackName paths: "/{proxy+}": x-amazon-apigateway-any-method: x-amazon-apigateway-integration: httpMethod: ANY type: aws_proxy uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03- 31/functions/${GetHtmlFunction.Arn}/invocations
  • 25. CloudFormation Package/Deploy aws cloudformation package --s3-bucket <BUCKET> --s3-prefix packages --template-file template.yaml --output-template-file output-template.json aws cloudformation deploy --template-file ./output-template.json --stack-name <STACK> --capabilities CAPABILITY_IAM
  • 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
  • 33. Safe deployments baked into SAM! AWSTemplateFormatVersion: '2010-09-09’ Transform: AWS::Serverless-2016-10-31 Resources: GetHtmlFunction: Type: AWS::Serverless::Function Properties: CodeUri: s3://demo-bucket/todo_list.zip Handler: index.js Runtime: nodejs6.1 New
  • 34. Safe deployments baked into SAM! AWSTemplateFormatVersion: '2010-09-09’ Transform: AWS::Serverless-2016-10-31 Globals: Function: AutoPublishAlias: Live DeploymentPreference: Type: Canary10Percent10Minutes Resources: GetHtmlFunction: Type: AWS::Serverless::Function Properties: CodeUri: s3://demo-bucket/todo_list.zip Handler: index.js Runtime: nodejs6.1 Policies: AmazonDynamoDBReadOnlyAccess New
  • 35. Safe deployments baked into SAM! AWSTemplateFormatVersion: '2010-09-09’ Transform: AWS::Serverless-2016-10-31 Globals: Function: AutoPublishAlias: Live DeploymentPreference: Type: Canary10Percent10Minutes Hooks: PreTraffic: !Ref CodeDeployHook_PreTest PostTraffic: !Ref CodeDeployHook_PostTest Alarms: - !Ref DurationAlarm - !Ref ErrorAlarm Resources: GetHtmlFunction: Type: AWS::Serverless::Function Properties: CodeUri: s3://demo-bucket/todo_list.zip Handler: index.js Runtime: nodejs6.1 Policies: AmazonDynamoDBReadOnlyAccess 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
  • 39. Intro to Serverless Application Architecture Danilo Poccia Evangelist, Serverless danilop@amazon.com @danilop danilop