SlideShare ist ein Scribd-Unternehmen logo
1 von 47
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved.
Diego Natali
AWS Solutions Architect
Serverless Computing
Build and run applications
without thinking about servers
Serverless Means …
No servers to provision
or manage
Scales with usage
Never pay for idle Built-in availability and
fault tolerance
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved.
Demo
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Demo Architecture
Internet
Bees with
machine guns
Bees with
machine guns
Bees with
machine guns
Application
Load Balancer
Up to 2000 requests
Amazon API
Gateway
Auto Scaling group
instance instance
instance
instance
instance instance
import random
def lambda_handler(event, context):
number = random.randint(0,1000000)
return number
Serverless Applications
Services (anything)
Changes in
data state
Requests to
endpoints
Changes in
resource state
Event source Lambda function
Node.js
Python
Java
C# (.NET Core & Core
2.0)
Go
Services for Building Serverless Applications
AWS Lambda
Amazon DynamoDB
Amazon SNS
Amazon API Gateway
Amazon SQS
Amazon Kinesis
Amazon S3
Compute and API Proxy
AWS X-Ray
AWS Step Functions
Datastores, Storage, Orchestration, Analytics, Interprocess Messaging
Developer Tools
AWS CodeBuild
AWS CodePipeline
AWS Serverless
Application Model (SAM)
Open Source and
third parties
Lambda@Edge
AWS Cloud9
Amazon Aurora
Serverless (preview)
AWS AppSync
Common Serverless Application Use Cases
Web
applications
• 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
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved.
Deep Dive/Components
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Using AWS Lambda
Bring your own code
• Node.js, Java, Python,
C#, Go
• Bring your own libraries
(even native ones)
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
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
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
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
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 That Trigger AWS Lambda
… and more on the way.
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
Amazon API Gateway
Create a unified
API frontend 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
API Gateway Integrations
Internet
Mobile
apps
Websites
Services
AWS Lambda
functions
AWS
API Gateway Cache
Endpoints on
Amazon EC2
All publicly
accessible
endpoints
Amazon CloudWatch
Monitoring
Amazon
CloudFront
Any other
AWS service
Your
VPC
Endpoints
in your VPC
Regional API endpoints
AWS Step Functions
Easily coordinate multiple Lambda functions using visual workflows
Visualize in the
console
Define in JSON Monitor
executions
Benefits of Step Functions Orchestration
Change and add steps
without writing code to
evolve applications
and innovate faster
Coordinate and visualize
Lambda functions as a
series of steps to quickly
create serverless apps
Automatically trigger and
track each step at scale
and handle errors with
built-in retry and fallback
Productivity AgilityResilience
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)
https://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/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
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM Local
AWS 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:
• Emulates timeout, memory limits, runtimes
https://github.com/awslabs/aws-sam-local
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved.
Customer/Partner References
Customers Love AWS Lambda
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved.
Comune di Cagliari
Pierangelo Lucio Orofino
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved.
What’s new?
What’s New in Serverless (cont.’d)
• Easy-to-use IDE in the cloud
• Built-in GitHub support
• Built-in Lambda blueprint support
• Built-in SAM Local:
• Local testing
• IDE debugging
• Deploy directly to Lambda or push
updates to GitHub
Cloud 9
NEW!
AWS Serverless Application Repository
• Search and browse ready-made apps and samples
• Customize open-source apps to get started quickly
• Share apps privately or publically
• Monetize APIs using the AWS Marketplace
• All apps powered by AWS SAM
AWS Lambda Concurrency control
• Lambda: Concurrency metric
• Lambda: Per-function concurrency throttles
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved.
Serverless DevOps / Deployment
Components
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
version NEW
How do we deploy a new version of our code?
version OLD
?
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Serverless Deployment Pattern Considerations
Minimizing Impact
to consumers
Rollback technique Execution model
factors
Deployment Speed
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Serverless Deployment Patterns
All at once
All traffic goes from
version OLD to NEW
at once.
Canaries/Linear
A small % of
production traffic is
sent to version NEW,
the remainder to
version OLD. After
some period of
waiting for validation,
traffic is shifted
incrementally (with
further validation) or
fully to version NEW.
Blue/Green
Version NEW is
deployed and tested
against before taking
production traffic.
After validated all
traffic goes from
version OLD to NEW
at once.
Serverless Deployment Patterns Consideration Matrix
Consumer impact Rollback Event Model
Factors
Deployment
Speed
All at once All at once Redeploy
older version
Any event model
at low concurrency
rate
Immediate
Blue/Green All at once with some
level of production
environment testing
beforehand
Revert traffic
to OLD
Better for async
and sync event
models at medium
concurrency
workloads
Minutes to
hours of
validation and
then immediate
to customers
Canaries/
Linear
1-10% typical initial
traffic shift, then
phased increases or
all at once
Revert traffic
to OLD
Better for high
concurrency
workloads
Minutes to
hours
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
NEW: Can deploy AWS Lambda!!
Uses AWS SAM to deploy serverless applications
Supports Lambda Alias Traffic Shifting enabling
canaries and blue|green deployments
Can rollback based on CloudWatch Metrics/Alarms
Pre/Post-Traffic Triggers can integrate with other
services (or even call Lambda functions)
AWS CodeDeploy + Lambda
NEW!
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM Globals + Safe Deployments
Globals:
Function:
Runtime: nodejs4.3
AutoPublishAlias: !Ref ENVIRONMENT
MyLambdaFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
DeploymentPreference:
Type: Linear10PercentEvery10Minutes
Alarms:
# A list of alarms that you want to monitor
- !Ref AliasErrorMetricGreaterThanZeroAlarm
- !Ref LatestVersionErrorMetricGreaterThanZeroAlarm
Hooks:
# Validation Lambda functions that are run before & after traffic shifting
PreTraffic: !Ref PreTrafficLambdaFunction
PostTraffic: !Ref PostTrafficLambdaFunction
NEW!
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lambda Alias Traffic Shifting & AWS SAM
Alarms: # A list of alarms that you want to monitor
- !Ref AliasErrorMetricGreaterThanZeroAlarm
- !Ref LatestVersionErrorMetricGreaterThanZeroAlarm
Hooks: # Validation Lambda functions that are run
before & after traffic shifting
PreTraffic: !Ref PreTrafficLambdaFunction
PostTraffic: !Ref PostTrafficLambdaFunction
In SAM:
Note: You can specify a maximum of 10 alarms
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon API Gateway Canary Support
Use canary release deployments to gradually roll out new APIs in
Amazon API Gateway:
• configure percent of traffic to go to a new stage deployment
• can test stage settings and variables
• API gateway will create additional Amazon CloudWatch Logs
group and CloudWatch metrics for the requests handled by the
canary deployment API
• To rollback: delete the deployment or set percent of traffic to 0
NEW!
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved.
Thank you & Build on!
aws.amazon.com/serverless

Weitere ähnliche Inhalte

Was ist angesagt?

Getting Started on AWS - AWSome Day 2018
Getting Started on AWS - AWSome Day 2018Getting Started on AWS - AWSome Day 2018
Getting Started on AWS - AWSome Day 2018
Amazon Web Services
 

Was ist angesagt? (20)

Getting Started on AWS - AWSome Day 2018
Getting Started on AWS - AWSome Day 2018Getting Started on AWS - AWSome Day 2018
Getting Started on AWS - AWSome Day 2018
 
Modern Application Development for Startups
Modern Application Development for StartupsModern Application Development for Startups
Modern Application Development for Startups
 
Adding the Sec to Your DevOps Pipelines: AWS Security Week at the SF Loft
Adding the Sec to Your DevOps Pipelines: AWS Security Week at the SF LoftAdding the Sec to Your DevOps Pipelines: AWS Security Week at the SF Loft
Adding the Sec to Your DevOps Pipelines: AWS Security Week at the SF Loft
 
Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)
Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)
Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)
 
Learn how Maxwell Health Protects its MongoDB Workloads on AWS
 Learn how Maxwell Health Protects its MongoDB Workloads on AWS Learn how Maxwell Health Protects its MongoDB Workloads on AWS
Learn how Maxwell Health Protects its MongoDB Workloads on AWS
 
Building and Deploying Your First Serverless Application
Building and Deploying Your First Serverless ApplicationBuilding and Deploying Your First Serverless Application
Building and Deploying Your First Serverless Application
 
Building Serverless Microservices with AWS
Building Serverless Microservices with AWSBuilding Serverless Microservices with AWS
Building Serverless Microservices with AWS
 
Build a Serverless Web Application in One Day
Build a Serverless Web Application in One DayBuild a Serverless Web Application in One Day
Build a Serverless Web Application in One Day
 
Evolve Your Incident Response Process and Powers for AWS
Evolve Your Incident Response Process and Powers for AWS Evolve Your Incident Response Process and Powers for AWS
Evolve Your Incident Response Process and Powers for AWS
 
CI/CD with AWS Developer Tools and Fargate
CI/CD with AWS Developer Tools and FargateCI/CD with AWS Developer Tools and Fargate
CI/CD with AWS Developer Tools and Fargate
 
Module 5: AWS Elasticity and Management Tools - AWSome Day Online Conference
Module 5: AWS Elasticity and Management Tools - AWSome Day Online Conference Module 5: AWS Elasticity and Management Tools - AWSome Day Online Conference
Module 5: AWS Elasticity and Management Tools - AWSome Day Online Conference
 
Overview of Serverless Application Deployment Patterns - AWS Online Tech Talks
Overview of Serverless Application Deployment Patterns - AWS Online Tech TalksOverview of Serverless Application Deployment Patterns - AWS Online Tech Talks
Overview of Serverless Application Deployment Patterns - AWS Online Tech Talks
 
An Introduction to AWS - AWS Summit Tel Aviv 2017
An Introduction to AWS - AWS Summit Tel Aviv 2017An Introduction to AWS - AWS Summit Tel Aviv 2017
An Introduction to AWS - AWS Summit Tel Aviv 2017
 
Interstella GTC: Monolith to Microservices with ECS
Interstella GTC: Monolith to Microservices with ECSInterstella GTC: Monolith to Microservices with ECS
Interstella GTC: Monolith to Microservices with ECS
 
Cloudschool 2014
Cloudschool 2014Cloudschool 2014
Cloudschool 2014
 
Identity Round Robin Workshop - Serverless Round: Security Week at the SF Loft
Identity Round Robin Workshop - Serverless Round: Security Week at the SF LoftIdentity Round Robin Workshop - Serverless Round: Security Week at the SF Loft
Identity Round Robin Workshop - Serverless Round: Security Week at the SF Loft
 
Serverless SaaS apllications on AWS
Serverless SaaS apllications on AWSServerless SaaS apllications on AWS
Serverless SaaS apllications on AWS
 
Analyzing Your Web and Application Logs
Analyzing Your Web and Application Logs Analyzing Your Web and Application Logs
Analyzing Your Web and Application Logs
 
Serverless Architecture Patterns
Serverless Architecture PatternsServerless Architecture Patterns
Serverless Architecture Patterns
 
Module 2: Core AWS Compute and Storage Services - Virtual AWSome Day June 2018
Module 2: Core AWS Compute and Storage Services - Virtual AWSome Day June 2018Module 2: Core AWS Compute and Storage Services - Virtual AWSome Day June 2018
Module 2: Core AWS Compute and Storage Services - Virtual AWSome Day June 2018
 

Ähnlich wie Forza Computazionale e Applicazioni Serverless

Serverless Architecture - Design Patterns and Best Practices
Serverless Architecture - Design Patterns and Best PracticesServerless Architecture - Design Patterns and Best Practices
Serverless Architecture - Design Patterns and Best Practices
Amazon Web Services
 

Ähnlich wie Forza Computazionale e Applicazioni Serverless (20)

Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 
Serverless computing - Build and run applications without thinking about servers
Serverless computing - Build and run applications without thinking about serversServerless computing - Build and run applications without thinking about servers
Serverless computing - Build and run applications without thinking about servers
 
Wildrydes Serverless Workshop Tel Aviv
Wildrydes Serverless Workshop Tel AvivWildrydes Serverless Workshop Tel Aviv
Wildrydes Serverless Workshop Tel Aviv
 
Scaling and Automating DevOps with CloudBees and Spot Instances (GPSTEC310) -...
Scaling and Automating DevOps with CloudBees and Spot Instances (GPSTEC310) -...Scaling and Automating DevOps with CloudBees and Spot Instances (GPSTEC310) -...
Scaling and Automating DevOps with CloudBees and Spot Instances (GPSTEC310) -...
 
Introduction to Serverless on AWS
Introduction to Serverless on AWSIntroduction to Serverless on AWS
Introduction to Serverless on AWS
 
Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to Serverless
 
Getting Started with AWS Lambda & Serverless Computing
Getting Started with AWS Lambda & Serverless ComputingGetting Started with AWS Lambda & Serverless Computing
Getting Started with AWS Lambda & Serverless Computing
 
Serverless Architectural Patterns
Serverless Architectural PatternsServerless Architectural Patterns
Serverless Architectural Patterns
 
Serverless Computing: build and run applications without thinking about servers
Serverless Computing: build and run applications without thinking about serversServerless Computing: build and run applications without thinking about servers
Serverless Computing: build and run applications without thinking about servers
 
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
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep Dive
 
Serverless use cases with AWS Lambda - More Serverless Event
Serverless use cases with AWS Lambda - More Serverless EventServerless use cases with AWS Lambda - More Serverless Event
Serverless use cases with AWS Lambda - More Serverless Event
 
SRV315 Building Enterprise-Grade Serverless Apps
 SRV315 Building Enterprise-Grade Serverless Apps SRV315 Building Enterprise-Grade Serverless Apps
SRV315 Building Enterprise-Grade Serverless Apps
 
Developing Serverless Application on AWS
Developing Serverless Application on AWSDeveloping Serverless Application on AWS
Developing Serverless Application on AWS
 
Ci/CD for AWS Lambda Projects - JLM CTO Club
Ci/CD for AWS Lambda Projects - JLM CTO ClubCi/CD for AWS Lambda Projects - JLM CTO Club
Ci/CD for AWS Lambda Projects - JLM CTO Club
 
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...
 
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
 
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
 
Serverless Architecture - Design Patterns and Best Practices
Serverless Architecture - Design Patterns and Best PracticesServerless Architecture - Design Patterns and Best Practices
Serverless Architecture - Design Patterns and Best Practices
 

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
 

Forza Computazionale e Applicazioni Serverless

  • 1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. Diego Natali AWS Solutions Architect Serverless Computing Build and run applications without thinking about servers
  • 2. Serverless Means … No servers to provision or manage Scales with usage Never pay for idle Built-in availability and fault tolerance
  • 3. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. Demo
  • 4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Demo Architecture Internet Bees with machine guns Bees with machine guns Bees with machine guns Application Load Balancer Up to 2000 requests Amazon API Gateway Auto Scaling group instance instance instance instance instance instance import random def lambda_handler(event, context): number = random.randint(0,1000000) return number
  • 5. Serverless Applications Services (anything) Changes in data state Requests to endpoints Changes in resource state Event source Lambda function Node.js Python Java C# (.NET Core & Core 2.0) Go
  • 6. Services for Building Serverless Applications AWS Lambda Amazon DynamoDB Amazon SNS Amazon API Gateway Amazon SQS Amazon Kinesis Amazon S3 Compute and API Proxy AWS X-Ray AWS Step Functions Datastores, Storage, Orchestration, Analytics, Interprocess Messaging Developer Tools AWS CodeBuild AWS CodePipeline AWS Serverless Application Model (SAM) Open Source and third parties Lambda@Edge AWS Cloud9 Amazon Aurora Serverless (preview) AWS AppSync
  • 7. Common Serverless Application Use Cases Web applications • 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. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. Deep Dive/Components
  • 9. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Using AWS Lambda Bring your own code • Node.js, Java, Python, C#, Go • Bring your own libraries (even native ones) 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
  • 10. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 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
  • 11. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 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 That Trigger AWS Lambda … and more on the way. AWS CodeCommit Amazon API Gateway Amazon Alexa AWS IoT AWS Step Functions
  • 12. 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
  • 13. Amazon API Gateway Create a unified API frontend 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
  • 14. API Gateway Integrations Internet Mobile apps Websites Services AWS Lambda functions AWS API Gateway Cache Endpoints on Amazon EC2 All publicly accessible endpoints Amazon CloudWatch Monitoring Amazon CloudFront Any other AWS service Your VPC Endpoints in your VPC Regional API endpoints
  • 15. AWS Step Functions Easily coordinate multiple Lambda functions using visual workflows Visualize in the console Define in JSON Monitor executions
  • 16. Benefits of Step Functions Orchestration Change and add steps without writing code to evolve applications and innovate faster Coordinate and visualize Lambda functions as a series of steps to quickly create serverless apps Automatically trigger and track each step at scale and handle errors with built-in retry and fallback Productivity AgilityResilience
  • 17. 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) https://github.com/awslabs/serverless-application-model
  • 18. 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/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
  • 19. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS SAM Local AWS 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: • Emulates timeout, memory limits, runtimes https://github.com/awslabs/aws-sam-local
  • 20. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. Customer/Partner References
  • 22. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. Comune di Cagliari Pierangelo Lucio Orofino
  • 23. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 24. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 25. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 26. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 27. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 28. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 29. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 30. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 31. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 32. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 33. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 34. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. What’s new?
  • 35. What’s New in Serverless (cont.’d) • Easy-to-use IDE in the cloud • Built-in GitHub support • Built-in Lambda blueprint support • Built-in SAM Local: • Local testing • IDE debugging • Deploy directly to Lambda or push updates to GitHub Cloud 9 NEW!
  • 36. AWS Serverless Application Repository • Search and browse ready-made apps and samples • Customize open-source apps to get started quickly • Share apps privately or publically • Monetize APIs using the AWS Marketplace • All apps powered by AWS SAM
  • 37. AWS Lambda Concurrency control • Lambda: Concurrency metric • Lambda: Per-function concurrency throttles
  • 38. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. Serverless DevOps / Deployment Components
  • 39. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. version NEW How do we deploy a new version of our code? version OLD ?
  • 40. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Serverless Deployment Pattern Considerations Minimizing Impact to consumers Rollback technique Execution model factors Deployment Speed
  • 41. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Serverless Deployment Patterns All at once All traffic goes from version OLD to NEW at once. Canaries/Linear A small % of production traffic is sent to version NEW, the remainder to version OLD. After some period of waiting for validation, traffic is shifted incrementally (with further validation) or fully to version NEW. Blue/Green Version NEW is deployed and tested against before taking production traffic. After validated all traffic goes from version OLD to NEW at once.
  • 42. Serverless Deployment Patterns Consideration Matrix Consumer impact Rollback Event Model Factors Deployment Speed All at once All at once Redeploy older version Any event model at low concurrency rate Immediate Blue/Green All at once with some level of production environment testing beforehand Revert traffic to OLD Better for async and sync event models at medium concurrency workloads Minutes to hours of validation and then immediate to customers Canaries/ Linear 1-10% typical initial traffic shift, then phased increases or all at once Revert traffic to OLD Better for high concurrency workloads Minutes to hours
  • 43. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. NEW: Can deploy AWS Lambda!! Uses AWS SAM to deploy serverless applications Supports Lambda Alias Traffic Shifting enabling canaries and blue|green deployments Can rollback based on CloudWatch Metrics/Alarms Pre/Post-Traffic Triggers can integrate with other services (or even call Lambda functions) AWS CodeDeploy + Lambda NEW!
  • 44. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM Globals + Safe Deployments Globals: Function: Runtime: nodejs4.3 AutoPublishAlias: !Ref ENVIRONMENT MyLambdaFunction: Type: AWS::Serverless::Function Properties: Handler: index.handler DeploymentPreference: Type: Linear10PercentEvery10Minutes Alarms: # A list of alarms that you want to monitor - !Ref AliasErrorMetricGreaterThanZeroAlarm - !Ref LatestVersionErrorMetricGreaterThanZeroAlarm Hooks: # Validation Lambda functions that are run before & after traffic shifting PreTraffic: !Ref PreTrafficLambdaFunction PostTraffic: !Ref PostTrafficLambdaFunction NEW!
  • 45. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lambda Alias Traffic Shifting & AWS SAM Alarms: # A list of alarms that you want to monitor - !Ref AliasErrorMetricGreaterThanZeroAlarm - !Ref LatestVersionErrorMetricGreaterThanZeroAlarm Hooks: # Validation Lambda functions that are run before & after traffic shifting PreTraffic: !Ref PreTrafficLambdaFunction PostTraffic: !Ref PostTrafficLambdaFunction In SAM: Note: You can specify a maximum of 10 alarms
  • 46. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon API Gateway Canary Support Use canary release deployments to gradually roll out new APIs in Amazon API Gateway: • configure percent of traffic to go to a new stage deployment • can test stage settings and variables • API gateway will create additional Amazon CloudWatch Logs group and CloudWatch metrics for the requests handled by the canary deployment API • To rollback: delete the deployment or set percent of traffic to 0 NEW!
  • 47. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. Thank you & Build on! aws.amazon.com/serverless