SlideShare ist ein Scribd-Unternehmen logo
1 von 41
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Alex Casalboni
Technical Evangelist, AWS
How to Build and Deploy Serverless Apps
@alex_casalboni
About me
• Software Engineer & Web Developer
• Serverless Lover & AI Enthusiast
• AWS Customer since 2013
Agenda
1. What is serverless computing
2. Serverless patterns on AWS
3. What customers are building
4. Safe deployments for AWS Lambda
5. Demo time
bit.ly/cape-town-serverless
What is serverless computing
Serverless Computing in a nutshell
No servers to provision
or manage
Scales with usage
Never pay for idle Built-in availability and
fault tolerance
Event-driven architectures
Services (anything)
Changes in
data state
Requests to
endpoints
Changes in
resource state
Event source Lambda function
Node.js
Python
Java
C#
Go
Common Use Cases
Web apps
• Static
websites
• Complex web
apps
• Packages for
Flask and
Express
Data processing
• Real time
• MapReduce
• Batch
• Machine learning
inference
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
Amazon S3 Amazon
DynamoDB
Amazon
Kinesis
AWS
CloudFormation
AWS CloudTrail Amazon
CloudWatch
Amazon
Cognito
Amazon SNSAmazon
SES
Cron events
Data stores Endpoints
Configuration repositories Event/message services
Example Event Sources
… and more on the way.
AWS
CodeCommit
Amazon
API Gateway
Amazon
Alexa
AWS IoT AWS Step
Functions
Amazon
SQS
New
Serverless patterns on AWS
Using AWS Lambda
Simple resource model
• Select power rating
from 128 MB to 3 GB
• CPU and network
allocated
proportionately
Flexible use
• Synchronous or
asynchronous
• Integrated with other
AWS services
Flexible authorization
• Securely grant access to
resources and VPCs
• Fine-grained control for
invoking your functions
Bring your own code
• Node.js, Java, Python,
C#, Go
• Bring your own libraries
(even native ones)
Using AWS Lambda
Authoring functions
• WYSIWYG editor or
upload packaged .zip
• AWS Cloud9 IDE
• Third-party plugins
(Eclipse, Visual Studio)
Monitoring and logging
• Metrics for requests,
errors, and throttles
• Built-in logs to Amazon
CloudWatch Logs
• Distributed tracing with
AWS X-Ray
Programming model
• Use processes, threads,
/tmp, sockets normally
• AWS SDK built in
(Python and Node.js)
Stateless
• Persist data using
external storage
• No affinity or access to
underlying infrastructure
AWS Lambda Execution Model
Synchronous (push) Asynchronous (event) Stream-based
Amazon
API Gateway
AWS Lambda
function
Amazon
DynamoDBAmazon
SNS
AWS Lambda
function
Amazon
S3
reqs changes
AWS Lambda
service
function
/order
Amazon
Kinesis
Amazon API Gateway
Unified API
frontend
Authenticate and
authorize requests
DDoS protection
and throttling
Throttle, meter,
and monetize APIs
Mobile Apps
Websites
Services
Amazon API Gateway
API Gateway
Cache
Public
Endpoints on
Amazon EC2
Amazon
CloudWatch
Monitoring
All publicly
accessible
endpoints
Lambda
Functions
Endpoints
in VPC
Applications
& Services
in VPC
Any other
AWS service
Fully-managed
CloudFront
Distribution
Edge-OptimizedRegionalPrivate
Customer-managed
CloudFront
Distribution
Applications
& Services
in the same
AWS Region
AWS Direct
Connect
On-premises
Amazon API Gateway Integrations
AWS Lambda@Edge
Write Node.js code,
upload it to Lambda,
and run it on 120+
edge locations
Run code at an AWS
location close to your end
user with CloudFront’s
global network
Leverage computation at
the edge and CloudFront’s
caching functionalities to
reduce origin load
Programing modelReduce Origin LoadGlobal network
New
AWS Lambda@Edge Triggers
What customers are building
Who’s using AWS Lambda?
EOH
eSignatures – Serverless Architecture on AWS
Managing Director
Andy Papastefanou
July 2018
Electronic Consent
Electronic Signatures
Transaction Approval
Secure Document Delivery
Developer Toolkit & Connectors
• Proudly South African, started in 2011.
• Gartner Aspiring Innovator 2016.
• Acquired by EOH in 2017.
• 20+ Enterprise customers. 14,000 signing stations.
1m+ monthly transactions.
Supporting Functions
SERVERLESS COMPONENTS DEPLOYED
Amazon
Quicksight
Amazon
RedShift
Amazon
Cognito
Amazon
VPC
AWS Lambda
Amazon
DynamoDB
Amazon
API Gateway
Amazon
S3
Amazon
Route53
Amazon
CloudWatch
AWS
CloudHSM
Amazon
SNS
Amazon
SQS
Amazon
SES
AWS
IAM
AWS
Device Farm
AWS
Mobile SDK
Mobile AppsAnalyticsPlatform Messaging
Storage
WHERE SHOULD YOU START?
WHY WE CHOSE AWS (AND SERVERLESS)
Developers focus
on building
functionality
Multiple
programming
languages co-exist
Platform stability Scalability &
Availability
WHY WE CHOSE AWS (AND SERVERLESS)
Architectural &
release agility
AWS Free TierSafe & gradual
deployments
Deep visibility into
code execution &
performance
VITAL STATS
FIRST 6 MONTHS AFTER LAUNCH
• Mobile App Downloads
~ 60,000
• Lambda Invocations
~ 1,2 million monthly
• AWS Costs
$173 to $1,400 monthly (R2,400 to R20k)
Stable costs despite the linear growth
JOURNEY TO THE AWS MARKETPLACE
Signature Audit
& Workflow
Web Signing
Platform
Mobile App
Platform
Impression SDK
Signature
APIs
Impression Cloud
Certificate
Services
Biometric
Analysis
Forensic
Analysis Tools
Platform
Devices
Fingerprint
Handwritten
Signature
USSD with
Sim Swap
SMS
OTP / KBA
Advanced
eSignature
Click-to-Sign
Directory
AuthNFactors GPS &
Location
Device
Identifiers
Commodity
Desktop
Apps
Desktop App
Plugins
Cloud App
Connectors
SaaS Consumer
Apps
Developer Community
Consumption
EOH
www.impression-signatures.com
andyp@impression.cloud
Safe deployments for AWS Lambda
AWS Serverless Application Model (SAM)
Simplified template driven deployment
model for serverless applications
Supported serverless resource types:
functions, APIs, and tables
Supports anything AWS CloudFormation
supports
Open specification (Apache 2.0)
github.com/awslabs/serverless-application-model
SAM Template
Tells AWS CloudFormation this is a
SAM template it needs to transform
Creates a Lambda function with the
referenced managed IAM policy,
runtime, code at the referenced zip
location, and handler as defined.
Also creates an API Gateway and
takes care of all mapping and
permissions necessary
Creates a DynamoDB table with five
read & write units
AWSTemplateFormatVersion: '2010-09-09’
Transform: AWS::Serverless-2016-10-31
Resources:
GetHtmlFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://sam-demo-bucket/todo_list.zip
Handler: index.gethtml
Runtime: nodejs4.3
Policies: AmazonDynamoDBReadOnlyAccess
Events:
GetHtml:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
ListTable:
Type: AWS::Serverless::SimpleTable
SAM Template Properties
Handler: index.js
Runtime: nodejs4.3
CodeUri: 's3://my-bucket/my-function.zip'
Description: Creates thumbnails
MemorySize: 1024
Timeout: 15
Policies: AmazonS3FullAccess
Environment:
Variables:
TABLE_NAME: my-table
Events:
PhotoUpload:
Type: S3
Properties:
Bucket: my-photo-bucket
Tracing: Active|PassThrough
From SAM version 2016-10-31
AWS::Serverless::Function
AWS::Serverless::Api
AWS::Serverless::SimpleTable
SAM Template Properties
StageName: prod
DefinitionUri: swagger.yml
CacheClusterEnabled: true
CacheClusterSize: 28.4
Variables:
VarName: VarValue
From SAM version 2016-10-31
AWS::Serverless::Function
AWS::Serverless::Api
AWS::Serverless::SimpleTable
SAM Template Properties
PrimaryKey:
Name: id
Type: String
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
From SAM version 2016-10-31
AWS::Serverless::Function
AWS::Serverless::Api
AWS::Serverless::SimpleTable
github.com/awslabs/aws-sam-local
AWS SAM CLI
CLI tool for local testing of serverless apps
Works with Lambda functions and “proxy-style” APIs
Response object and function logs available on your
local machine
Uses open-source Docker-Lambda images to mimic
Lambda’s execution environment (timeout, memory
limits, runtimes)
Understanding “CI/CD”
Source Build Test Production
Continuous integration
Continuous delivery
Continuous deployment
Understanding “CI/CD” for AWS Lambda
Source Build Test Production
AWS
CodeCommit
AWS
CodeDeploy
AWS
CodeBuild
Third-party
tooling
AWS
CodePipeline
New
AWS CodeDeploy + Lambda
Deployment Preference Type
Canary10Percent30Minutes
Canary10Percent5Minutes
Canary10Percent10Minutes
Canary10Percent15Minutes
Linear10PercentEvery10Minutes
Linear10PercentEvery1Minute
Linear10PercentEvery2Minutes
Linear10PercentEvery3Minutes
AllAtOnce
• Lambda Alias Traffic Shifting enables canaries
and blue|green deployments
• Automatic rollback based on CloudWatch
Metrics/Alarms
• Pre/Post-Traffic Triggers can integrate with
other services (or even call Lambda functions)
<demo time>
bit.ly/aws-sam-rollback-demo
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Alex Casalboni
Technical Evangelist, AWS
Thank you!
@alex_casalboni

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to Serverless
 
Introduction to AWS Lambda and Serverless Applications
Introduction to AWS Lambda and Serverless ApplicationsIntroduction to AWS Lambda and Serverless Applications
Introduction to AWS Lambda and Serverless Applications
 
Deep Dive on Serverless Web Applications - AWS May 2016 Webinar Series
Deep Dive on Serverless Web Applications - AWS May 2016 Webinar SeriesDeep Dive on Serverless Web Applications - AWS May 2016 Webinar Series
Deep Dive on Serverless Web Applications - AWS May 2016 Webinar Series
 
AWS Lambda Documentation
AWS Lambda DocumentationAWS Lambda Documentation
AWS Lambda Documentation
 
Security Best Practices for Serverless Applications - July 2017 AWS Online T...
Security Best Practices for Serverless Applications  - July 2017 AWS Online T...Security Best Practices for Serverless Applications  - July 2017 AWS Online T...
Security Best Practices for Serverless Applications - July 2017 AWS Online T...
 
Convert Your Code into a Microservice using AWS Lambda
Convert Your Code into a Microservice using AWS LambdaConvert Your Code into a Microservice using AWS Lambda
Convert Your Code into a Microservice using AWS Lambda
 
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
 
Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless Architecture
 
NEW LAUNCH! Enhance Your Mobile Apps with AI Using Amazon Lex
NEW LAUNCH! Enhance Your Mobile Apps with AI Using Amazon LexNEW LAUNCH! Enhance Your Mobile Apps with AI Using Amazon Lex
NEW LAUNCH! Enhance Your Mobile Apps with AI Using Amazon Lex
 
使用 Serverless 技術打造支援 Alexa 的物聯網服務
使用 Serverless 技術打造支援 Alexa 的物聯網服務使用 Serverless 技術打造支援 Alexa 的物聯網服務
使用 Serverless 技術打造支援 Alexa 的物聯網服務
 
Serverless Applications on AWS
Serverless Applications on AWSServerless Applications on AWS
Serverless Applications on AWS
 
Building API-Driven Microservices with Amazon API Gateway - AWS Online Tech T...
Building API-Driven Microservices with Amazon API Gateway - AWS Online Tech T...Building API-Driven Microservices with Amazon API Gateway - AWS Online Tech T...
Building API-Driven Microservices with Amazon API Gateway - AWS Online Tech T...
 
AWS Serverless Introduction (Lambda)
AWS Serverless Introduction (Lambda)AWS Serverless Introduction (Lambda)
AWS Serverless Introduction (Lambda)
 
Contruyendo tu primera aplicación con AWS
Contruyendo tu primera aplicación con AWSContruyendo tu primera aplicación con AWS
Contruyendo tu primera aplicación con AWS
 
ANZ Dev Lounge Session - Feb 2017
ANZ Dev Lounge Session - Feb 2017ANZ Dev Lounge Session - Feb 2017
ANZ Dev Lounge Session - Feb 2017
 
AWS August Webinar Series - Building Serverless Backends with AWS Lambda and ...
AWS August Webinar Series - Building Serverless Backends with AWS Lambda and ...AWS August Webinar Series - Building Serverless Backends with AWS Lambda and ...
AWS August Webinar Series - Building Serverless Backends with AWS Lambda and ...
 
What Is Serverless Computing
What Is Serverless ComputingWhat Is Serverless Computing
What Is Serverless Computing
 
AWS Amplify
AWS AmplifyAWS Amplify
AWS Amplify
 
BDA310 An Introduction to the AI services at AWS
BDA310 An Introduction to the AI services at AWSBDA310 An Introduction to the AI services at AWS
BDA310 An Introduction to the AI services at AWS
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep Dive
 

Ähnlich wie How to build and deploy serverless apps - AWS Summit Cape Town 2018

AWS Lambda 활용의 모든 것! - AWS Summit Seoul 2017
AWS Lambda 활용의 모든 것! - AWS Summit Seoul 2017AWS Lambda 활용의 모든 것! - AWS Summit Seoul 2017
AWS Lambda 활용의 모든 것! - AWS Summit Seoul 2017
Amazon Web Services Korea
 
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
Amazon Web Services
 

Ähnlich wie How to build and deploy serverless apps - AWS Summit Cape Town 2018 (20)

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
 
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 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
 
AWS Lambda 활용의 모든 것! - AWS Summit Seoul 2017
AWS Lambda 활용의 모든 것! - AWS Summit Seoul 2017AWS Lambda 활용의 모든 것! - AWS Summit Seoul 2017
AWS Lambda 활용의 모든 것! - AWS Summit Seoul 2017
 
SMC301 The State of Serverless Computing
SMC301 The State of Serverless ComputingSMC301 The State of Serverless Computing
SMC301 The State of Serverless Computing
 
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...
 
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
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
 
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
 
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
 
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 Serverless Architectures - August 2016 Monthly Webinar S...
Getting Started with Serverless Architectures - August 2016 Monthly Webinar S...Getting Started with Serverless Architectures - August 2016 Monthly Webinar S...
Getting Started with Serverless Architectures - August 2016 Monthly Webinar S...
 
The State of Serverless Computing | AWS Public Sector Summit 2017
The State of Serverless Computing | AWS Public Sector Summit 2017The State of Serverless Computing | AWS Public Sector Summit 2017
The State of Serverless Computing | AWS Public Sector Summit 2017
 
SRV302 Deep Dive on Serverless Application Development
SRV302 Deep Dive on Serverless Application DevelopmentSRV302 Deep Dive on Serverless Application Development
SRV302 Deep Dive on Serverless Application Development
 
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
 
Primeros pasos con arquitecturas serverless
Primeros pasos con arquitecturas serverlessPrimeros pasos con arquitecturas serverless
Primeros pasos con arquitecturas serverless
 
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
 
AWS Lambda: Event-driven Code for Devices and the Cloud
AWS Lambda: Event-driven Code for Devices and the CloudAWS Lambda: Event-driven Code for Devices and the Cloud
AWS Lambda: Event-driven Code for Devices and the Cloud
 

Mehr von Amazon 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 AWS
Amazon 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 Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon 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
 

Mehr von 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
 

How to build and deploy serverless apps - AWS Summit Cape Town 2018

  • 1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Alex Casalboni Technical Evangelist, AWS How to Build and Deploy Serverless Apps @alex_casalboni
  • 2. About me • Software Engineer & Web Developer • Serverless Lover & AI Enthusiast • AWS Customer since 2013
  • 3. Agenda 1. What is serverless computing 2. Serverless patterns on AWS 3. What customers are building 4. Safe deployments for AWS Lambda 5. Demo time bit.ly/cape-town-serverless
  • 4. What is serverless computing
  • 5. Serverless Computing in a nutshell No servers to provision or manage Scales with usage Never pay for idle Built-in availability and fault tolerance
  • 6. Event-driven architectures Services (anything) Changes in data state Requests to endpoints Changes in resource state Event source Lambda function Node.js Python Java C# Go
  • 7. Common Use Cases Web apps • Static websites • Complex web apps • Packages for Flask and Express Data processing • Real time • MapReduce • Batch • Machine learning inference 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
  • 8. Amazon S3 Amazon DynamoDB Amazon Kinesis AWS CloudFormation AWS CloudTrail Amazon CloudWatch Amazon Cognito Amazon SNSAmazon SES Cron events Data stores Endpoints Configuration repositories Event/message services Example Event Sources … and more on the way. AWS CodeCommit Amazon API Gateway Amazon Alexa AWS IoT AWS Step Functions Amazon SQS New
  • 10. Using AWS Lambda Simple resource model • Select power rating from 128 MB to 3 GB • CPU and network allocated proportionately Flexible use • Synchronous or asynchronous • Integrated with other AWS services Flexible authorization • Securely grant access to resources and VPCs • Fine-grained control for invoking your functions Bring your own code • Node.js, Java, Python, C#, Go • Bring your own libraries (even native ones)
  • 11. Using AWS Lambda Authoring functions • WYSIWYG editor or upload packaged .zip • AWS Cloud9 IDE • Third-party plugins (Eclipse, Visual Studio) Monitoring and logging • Metrics for requests, errors, and throttles • Built-in logs to Amazon CloudWatch Logs • Distributed tracing with AWS X-Ray Programming model • Use processes, threads, /tmp, sockets normally • AWS SDK built in (Python and Node.js) Stateless • Persist data using external storage • No affinity or access to underlying infrastructure
  • 12. AWS Lambda Execution Model Synchronous (push) Asynchronous (event) Stream-based Amazon API Gateway AWS Lambda function Amazon DynamoDBAmazon SNS AWS Lambda function Amazon S3 reqs changes AWS Lambda service function /order Amazon Kinesis
  • 13. Amazon API Gateway Unified API frontend Authenticate and authorize requests DDoS protection and throttling Throttle, meter, and monetize APIs
  • 14. Mobile Apps Websites Services Amazon API Gateway API Gateway Cache Public Endpoints on Amazon EC2 Amazon CloudWatch Monitoring All publicly accessible endpoints Lambda Functions Endpoints in VPC Applications & Services in VPC Any other AWS service Fully-managed CloudFront Distribution Edge-OptimizedRegionalPrivate Customer-managed CloudFront Distribution Applications & Services in the same AWS Region AWS Direct Connect On-premises Amazon API Gateway Integrations
  • 15. AWS Lambda@Edge Write Node.js code, upload it to Lambda, and run it on 120+ edge locations Run code at an AWS location close to your end user with CloudFront’s global network Leverage computation at the edge and CloudFront’s caching functionalities to reduce origin load Programing modelReduce Origin LoadGlobal network New
  • 17. What customers are building
  • 18. Who’s using AWS Lambda?
  • 19. EOH eSignatures – Serverless Architecture on AWS Managing Director Andy Papastefanou July 2018
  • 20. Electronic Consent Electronic Signatures Transaction Approval Secure Document Delivery Developer Toolkit & Connectors
  • 21. • Proudly South African, started in 2011. • Gartner Aspiring Innovator 2016. • Acquired by EOH in 2017. • 20+ Enterprise customers. 14,000 signing stations. 1m+ monthly transactions.
  • 22. Supporting Functions SERVERLESS COMPONENTS DEPLOYED Amazon Quicksight Amazon RedShift Amazon Cognito Amazon VPC AWS Lambda Amazon DynamoDB Amazon API Gateway Amazon S3 Amazon Route53 Amazon CloudWatch AWS CloudHSM Amazon SNS Amazon SQS Amazon SES AWS IAM AWS Device Farm AWS Mobile SDK Mobile AppsAnalyticsPlatform Messaging Storage
  • 24. WHY WE CHOSE AWS (AND SERVERLESS) Developers focus on building functionality Multiple programming languages co-exist Platform stability Scalability & Availability
  • 25. WHY WE CHOSE AWS (AND SERVERLESS) Architectural & release agility AWS Free TierSafe & gradual deployments Deep visibility into code execution & performance
  • 26. VITAL STATS FIRST 6 MONTHS AFTER LAUNCH • Mobile App Downloads ~ 60,000 • Lambda Invocations ~ 1,2 million monthly • AWS Costs $173 to $1,400 monthly (R2,400 to R20k) Stable costs despite the linear growth
  • 27. JOURNEY TO THE AWS MARKETPLACE Signature Audit & Workflow Web Signing Platform Mobile App Platform Impression SDK Signature APIs Impression Cloud Certificate Services Biometric Analysis Forensic Analysis Tools Platform Devices Fingerprint Handwritten Signature USSD with Sim Swap SMS OTP / KBA Advanced eSignature Click-to-Sign Directory AuthNFactors GPS & Location Device Identifiers Commodity Desktop Apps Desktop App Plugins Cloud App Connectors SaaS Consumer Apps Developer Community Consumption
  • 29. Safe deployments for AWS Lambda
  • 30. AWS Serverless Application Model (SAM) Simplified template driven deployment model for serverless applications Supported serverless resource types: functions, APIs, and tables Supports anything AWS CloudFormation supports Open specification (Apache 2.0) github.com/awslabs/serverless-application-model
  • 31. SAM Template Tells AWS CloudFormation this is a SAM template it needs to transform Creates a Lambda function with the referenced managed IAM policy, runtime, code at the referenced zip location, and handler as defined. Also creates an API Gateway and takes care of all mapping and permissions necessary Creates a DynamoDB table with five read & write units AWSTemplateFormatVersion: '2010-09-09’ Transform: AWS::Serverless-2016-10-31 Resources: GetHtmlFunction: Type: AWS::Serverless::Function Properties: CodeUri: s3://sam-demo-bucket/todo_list.zip Handler: index.gethtml Runtime: nodejs4.3 Policies: AmazonDynamoDBReadOnlyAccess Events: GetHtml: Type: Api Properties: Path: /{proxy+} Method: ANY ListTable: Type: AWS::Serverless::SimpleTable
  • 32. SAM Template Properties Handler: index.js Runtime: nodejs4.3 CodeUri: 's3://my-bucket/my-function.zip' Description: Creates thumbnails MemorySize: 1024 Timeout: 15 Policies: AmazonS3FullAccess Environment: Variables: TABLE_NAME: my-table Events: PhotoUpload: Type: S3 Properties: Bucket: my-photo-bucket Tracing: Active|PassThrough From SAM version 2016-10-31 AWS::Serverless::Function AWS::Serverless::Api AWS::Serverless::SimpleTable
  • 33. SAM Template Properties StageName: prod DefinitionUri: swagger.yml CacheClusterEnabled: true CacheClusterSize: 28.4 Variables: VarName: VarValue From SAM version 2016-10-31 AWS::Serverless::Function AWS::Serverless::Api AWS::Serverless::SimpleTable
  • 34. SAM Template Properties PrimaryKey: Name: id Type: String ProvisionedThroughput: ReadCapacityUnits: 5 WriteCapacityUnits: 5 From SAM version 2016-10-31 AWS::Serverless::Function AWS::Serverless::Api AWS::Serverless::SimpleTable
  • 35. github.com/awslabs/aws-sam-local AWS SAM CLI CLI tool for local testing of serverless apps Works with Lambda functions and “proxy-style” APIs Response object and function logs available on your local machine Uses open-source Docker-Lambda images to mimic Lambda’s execution environment (timeout, memory limits, runtimes)
  • 36. Understanding “CI/CD” Source Build Test Production Continuous integration Continuous delivery Continuous deployment
  • 37. Understanding “CI/CD” for AWS Lambda Source Build Test Production AWS CodeCommit AWS CodeDeploy AWS CodeBuild Third-party tooling AWS CodePipeline New
  • 38. AWS CodeDeploy + Lambda Deployment Preference Type Canary10Percent30Minutes Canary10Percent5Minutes Canary10Percent10Minutes Canary10Percent15Minutes Linear10PercentEvery10Minutes Linear10PercentEvery1Minute Linear10PercentEvery2Minutes Linear10PercentEvery3Minutes AllAtOnce • Lambda Alias Traffic Shifting enables canaries and blue|green deployments • Automatic rollback based on CloudWatch Metrics/Alarms • Pre/Post-Traffic Triggers can integrate with other services (or even call Lambda functions)
  • 41. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Alex Casalboni Technical Evangelist, AWS Thank you! @alex_casalboni