SlideShare une entreprise Scribd logo
1  sur  25
Télécharger pour lire hors ligne
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS re:INVENT
G P S : F r o m M o n o l i t h i c t o S e r v e r l e s s — W h y a n d
H o w t o M o v e
I a n S c o f i e l d | P a r t n e r S o l u t i o n s A r c h i t e c t
P a r a s B h u v a | P a r t n e r S o l u t i o n s A r c h i t e c t
G P S T E C 3 1 4
N o v e m b e r 2 8 , 2 0 1 7
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What is serverless?
• No provisioning
• Zero administration
• High availability
Fully managed
• Focus on the code that matters
• Innovate rapidly
• Reduce time to market
Developer productivity
• Automatically
• Scale up and scale down
Continuous scaling
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monolithic application
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Can’t fit a monolith inside Lambda
Webserver
Data Access Service
App service
Visualization
Service
Lambda
function
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monolithic versus microservices
vs
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Original monolithic application
Load
Balancer
Browser
Database
Webserver
Data Access Service
• On premises
• Tightly coupled application components
• Load balancer
• Relational database
App Service
Visualization
Service
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Hard to scale Can’t handle
component failures
Slow deployment
process
Limited options
Limitations
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How do we get there?
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Transformation steps
Discover Design Develop Deploy Refine
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
1. Identify
components
Visualization
Service
Webserver
Data Access Service
App Service
Database
2. Outline
requirements
Amazon
S3
Amazon
DynamoDB
AWS Lambda
Amazon API
Gateway
3. Map to
AWS resources
• State?
• Compute?
• API?
• Storage?
• Security?
• Managed?
• Estimated scale?
• Others
Where do we start? Discover
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rough architecture—design
Data stored in
Amazon
DynamoDB
Dynamic content
in AWS Lambda
Amazon API
Gateway
Browser
Amazon
CloudFront
Amazon
S3
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How do I secure it?
Amazon API
Gateway
AWS
Lambda
Amazon
S3
Amazon
CloudFront
Browser
Amazon
DynamoDB
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Define our initial security posture
Amazon API
Gateway
AWS
Lambda
Amazon
DynamoDB
Amazon
S3
Amazon
CloudFront
• Bucket Policies
• ACLs
• OAI
• Geo-Restriction
• Signed Cookies
• Signed URLs
• DDOS
IAM
AuthZ
IAM
• Throttling
• Caching
• Usage Plans
Browser
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monitoring your resources
Amazon API
Gateway
AWS
Lambda
Amazon
S3
Amazon
CloudFront
Browser
Amazon
DynamoDB
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monitoring your resources
Amazon API
Gateway
AWS
Lambda
Amazon
S3
Amazon
CloudFront
Browser
Amazon
DynamoDB
• Access Logs in
S3 Bucket
• CloudWatch
Metrics
• Access Logs in
S3 Bucket
AWS
CloudTrail
Amazon
CloudWatch
• Custom
CloudWatch
Metrics & Alarms
• Audit Log of All
AWS API Calls
• Latency
• Count
• Cache Hit/Miss
• 4XX/5XX Errors
• Invocations
• Invocation Errors
• Duration
• Throttled Invocations
• Throttled Reqs
• Returned Bytes
• Latency
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Frameworks—develop/deploy
1. AWS Serverless Application Model (SAM)
2. Serverless
3. Zappa
4. Chalice
5. Others
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Serverless Application Model (SAM)
AWS CloudFormation brings:
• Infrastructure as code
• Easy to provision and manage a collection of related AWS resources
• Input .yaml file and output provisioned AWS resources
• Optimized for infrastructure
AWS SAM:
• CloudFormation extension optimized for serverless
• New serverless resources: functions, APIs, and tables
• Supports anything CloudFormation supports
• Open specification (Apache 2.0)
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM: Less complexity, more power
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
Properties:
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
responses: {}
swagger: '2.0'
CF template example—API triggering Lambda
AWSTemplateFormatVersion: '2010-09-09’
Transform: AWS::Serverless-2016-10-31
Resources:
GetHtmlFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://flourish-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
AWS SAM example—API triggering Lambda
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Serverless app lifecycle management
AWS Serverless Application Model (SAM)
AWS
Lambda
Amazon API
Gateway
AWS
CloudFormation
Amazon
S3
Amazon
DynamoDB
Package &
Deploy
Code/Packages/
Swagger
Serverless
Template
Serverless
Template
w/CodeUri
package deploy
CI/CD Tools
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Demo + deep dive
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Please go here to vote—democlub.xyz
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Voting application—high level architecture
Data stored in
Amazon
DynamoDB
Dynamic content
in AWS Lambda
Amazon API
Gateway
Browser
Amazon
S3
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Browser
AuthZ
Amazon
DynamoDB
Amazon API
Gateway
• Throttling
• Caching
• Usage Plans
AWS
Lambda
IAM IAM
Amazon S3Amazon CloudFront
• Bucket Policies
• ACLs
• OAI
• Geo-Restriction
• Signed Cookies
• Signed URLs
• DDOS
Amazon Cognito
Amazon
Route 53
Detailed architecture
AWS
Lambda
Amazon
DynamoDB
Streams
IAM IAM
Aggregation
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Resources
Learning path (step by step guide)—https://aws.amazon.com/getting-
started/serverless-web-app/
Serverless page—https://aws.amazon.com/serverless/
Serverless architecture best practices (on YouTube)—https://youtu.be/b7UMoc1iUYw
Serverless Application Model (SAM) deep dive—https://youtu.be/e3lreqpWN0A
AWS Lambda deep dive—https://youtu.be/dB4zJk_fqrU
Developer Tooling—https://aws.amazon.com/serverless/developer-tools/
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you!

Contenu connexe

Tendances

Tendances (20)

User Based Multi Channel Engagement using Amazon Pinpoint and Amazon Cognito ...
User Based Multi Channel Engagement using Amazon Pinpoint and Amazon Cognito ...User Based Multi Channel Engagement using Amazon Pinpoint and Amazon Cognito ...
User Based Multi Channel Engagement using Amazon Pinpoint and Amazon Cognito ...
 
CTD403_Supercharge Your Websites with the Power of Lambda@Edge
CTD403_Supercharge Your Websites with the Power of Lambda@EdgeCTD403_Supercharge Your Websites with the Power of Lambda@Edge
CTD403_Supercharge Your Websites with the Power of Lambda@Edge
 
ARC205_Born in the Cloud
ARC205_Born in the CloudARC205_Born in the Cloud
ARC205_Born in the Cloud
 
CON320_Monitoring, Logging and Debugging Containerized Services
CON320_Monitoring, Logging and Debugging Containerized ServicesCON320_Monitoring, Logging and Debugging Containerized Services
CON320_Monitoring, Logging and Debugging Containerized Services
 
GPSWKS406-Migrating a Microsoft ASP.NET Application to AWS
GPSWKS406-Migrating a Microsoft ASP.NET Application to AWSGPSWKS406-Migrating a Microsoft ASP.NET Application to AWS
GPSWKS406-Migrating a Microsoft ASP.NET Application to AWS
 
Become a Serverless Black Belt: Optimizing Your Serverless Applications - SRV...
Become a Serverless Black Belt: Optimizing Your Serverless Applications - SRV...Become a Serverless Black Belt: Optimizing Your Serverless Applications - SRV...
Become a Serverless Black Belt: Optimizing Your Serverless Applications - SRV...
 
WIN204-Simplifying Microsoft Architectures with AWS Services
WIN204-Simplifying Microsoft Architectures with AWS ServicesWIN204-Simplifying Microsoft Architectures with AWS Services
WIN204-Simplifying Microsoft Architectures with AWS Services
 
MBL204_Architecting Cost-Effective Mobile Backends for Scale, Security, and P...
MBL204_Architecting Cost-Effective Mobile Backends for Scale, Security, and P...MBL204_Architecting Cost-Effective Mobile Backends for Scale, Security, and P...
MBL204_Architecting Cost-Effective Mobile Backends for Scale, Security, and P...
 
I Want to Analyze and Visualize Website Access Logs, but Why Do I Need Server...
I Want to Analyze and Visualize Website Access Logs, but Why Do I Need Server...I Want to Analyze and Visualize Website Access Logs, but Why Do I Need Server...
I Want to Analyze and Visualize Website Access Logs, but Why Do I Need Server...
 
Serverless Applications at Global Scale with Multi-Regional Deployments - AWS...
Serverless Applications at Global Scale with Multi-Regional Deployments - AWS...Serverless Applications at Global Scale with Multi-Regional Deployments - AWS...
Serverless Applications at Global Scale with Multi-Regional Deployments - AWS...
 
Building Best Practices and the Right Foundation for your 1st Production Work...
Building Best Practices and the Right Foundation for your 1st Production Work...Building Best Practices and the Right Foundation for your 1st Production Work...
Building Best Practices and the Right Foundation for your 1st Production Work...
 
WPS301-Navigating HIPAA and HITRUST_QuickStart Guide to Account Gov Strat.pdf
WPS301-Navigating HIPAA and HITRUST_QuickStart Guide to Account Gov Strat.pdfWPS301-Navigating HIPAA and HITRUST_QuickStart Guide to Account Gov Strat.pdf
WPS301-Navigating HIPAA and HITRUST_QuickStart Guide to Account Gov Strat.pdf
 
CON203_Driving Innovation with Containers
CON203_Driving Innovation with ContainersCON203_Driving Innovation with Containers
CON203_Driving Innovation with Containers
 
An Introduction to AI Services on AWS - Web Summit Lisbon
An Introduction to AI Services on AWS -  Web Summit LisbonAn Introduction to AI Services on AWS -  Web Summit Lisbon
An Introduction to AI Services on AWS - Web Summit Lisbon
 
FSV305-Optimizing Payments Collections with Containers and Machine Learning
FSV305-Optimizing Payments Collections with Containers and Machine LearningFSV305-Optimizing Payments Collections with Containers and Machine Learning
FSV305-Optimizing Payments Collections with Containers and Machine Learning
 
MBL209_Learn How MicroStrategy on AWS is Helping Vivint Solar Deliver Clean E...
MBL209_Learn How MicroStrategy on AWS is Helping Vivint Solar Deliver Clean E...MBL209_Learn How MicroStrategy on AWS is Helping Vivint Solar Deliver Clean E...
MBL209_Learn How MicroStrategy on AWS is Helping Vivint Solar Deliver Clean E...
 
GPSTEC323-SaaS and OpenID Connect The Secret Sauce Multi-Tenant Identity and ...
GPSTEC323-SaaS and OpenID Connect The Secret Sauce Multi-Tenant Identity and ...GPSTEC323-SaaS and OpenID Connect The Secret Sauce Multi-Tenant Identity and ...
GPSTEC323-SaaS and OpenID Connect The Secret Sauce Multi-Tenant Identity and ...
 
DEV322_Continuous Integration Best Practices for Software Development Teams
DEV322_Continuous Integration Best Practices for Software Development TeamsDEV322_Continuous Integration Best Practices for Software Development Teams
DEV322_Continuous Integration Best Practices for Software Development Teams
 
CMP319_Easily Coordinate Microservices, Build Serverless Apps, and Automate T...
CMP319_Easily Coordinate Microservices, Build Serverless Apps, and Automate T...CMP319_Easily Coordinate Microservices, Build Serverless Apps, and Automate T...
CMP319_Easily Coordinate Microservices, Build Serverless Apps, and Automate T...
 
SID301_Using AWS Lambda as a Security Team
SID301_Using AWS Lambda as a Security TeamSID301_Using AWS Lambda as a Security Team
SID301_Using AWS Lambda as a Security Team
 

Similaire à GPSTEC314-GPS From Monolithic to Serverless - Why and How to Move

Serverless Architecture and Best Practices
Serverless Architecture and Best PracticesServerless Architecture and Best Practices
Serverless Architecture and Best Practices
Amazon Web Services
 

Similaire à GPSTEC314-GPS From Monolithic to Serverless - Why and How to Move (20)

Introduction to Serverless Computing and AWS Lambda - AWS IL Meetup
Introduction to Serverless Computing and AWS Lambda - AWS IL MeetupIntroduction to Serverless Computing and AWS Lambda - AWS IL Meetup
Introduction to Serverless Computing and AWS Lambda - AWS IL Meetup
 
Serverless Architectural Patterns
Serverless Architectural PatternsServerless Architectural Patterns
Serverless Architectural Patterns
 
Serverless Architectural Patterns
Serverless Architectural PatternsServerless Architectural Patterns
Serverless Architectural Patterns
 
Serverless Architecture and Best Practices
Serverless Architecture and Best PracticesServerless Architecture and Best Practices
Serverless Architecture and Best Practices
 
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWSServerless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
 
Serverless use cases with AWS Lambda
Serverless use cases with AWS Lambda Serverless use cases with AWS Lambda
Serverless use cases with AWS Lambda
 
Serverless Architecture Patterns
Serverless Architecture PatternsServerless Architecture Patterns
Serverless Architecture Patterns
 
Deep Dive on Serverless App Development
Deep Dive on Serverless App DevelopmentDeep Dive on Serverless App Development
Deep Dive on Serverless App Development
 
Deep Dive On Serverless App Development
Deep Dive On Serverless App DevelopmentDeep Dive On Serverless App Development
Deep Dive On Serverless App Development
 
Monitoring and Troubleshooting in a Serverless World - SRV303 - re:Invent 2017
Monitoring and Troubleshooting in a Serverless World - SRV303 - re:Invent 2017Monitoring and Troubleshooting in a Serverless World - SRV303 - re:Invent 2017
Monitoring and Troubleshooting in a Serverless World - SRV303 - re:Invent 2017
 
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
 
Learn how to build serverless applications using the AWS Serverless Platform-...
Learn how to build serverless applications using the AWS Serverless Platform-...Learn how to build serverless applications using the AWS Serverless Platform-...
Learn how to build serverless applications using the AWS Serverless Platform-...
 
Building Serverless Microservices with AWS
Building Serverless Microservices with AWSBuilding Serverless Microservices with AWS
Building Serverless Microservices with AWS
 
Build a Serverless Backend for Requesting a Ride
Build a Serverless Backend for Requesting a RideBuild a Serverless Backend for Requesting a Ride
Build a Serverless Backend for Requesting a Ride
 
Build a Serverless Backend for Requesting a Ride
Build a Serverless Backend for Requesting a RideBuild a Serverless Backend for Requesting a Ride
Build a Serverless Backend for Requesting a Ride
 
What's New in Serverless - SRV305 - re:Invent 2017
What's New in Serverless - SRV305 - re:Invent 2017What's New in Serverless - SRV305 - re:Invent 2017
What's New in Serverless - SRV305 - re:Invent 2017
 
Getting started with Serverless on AWS
Getting started with Serverless on AWSGetting started with Serverless on AWS
Getting started with Serverless on AWS
 
Serverless DevOps to the Rescue
Serverless DevOps to the RescueServerless DevOps to the Rescue
Serverless DevOps to the Rescue
 
SRV313_Building Resilient, Multi-Region Serverless Applications
SRV313_Building Resilient, Multi-Region Serverless ApplicationsSRV313_Building Resilient, Multi-Region Serverless Applications
SRV313_Building Resilient, Multi-Region Serverless Applications
 
Application Performance Management on AWS
Application Performance Management on AWSApplication Performance Management on AWS
Application Performance Management on AWS
 

Plus de 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
 

Plus de 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
 

GPSTEC314-GPS From Monolithic to Serverless - Why and How to Move

  • 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS re:INVENT G P S : F r o m M o n o l i t h i c t o S e r v e r l e s s — W h y a n d H o w t o M o v e I a n S c o f i e l d | P a r t n e r S o l u t i o n s A r c h i t e c t P a r a s B h u v a | P a r t n e r S o l u t i o n s A r c h i t e c t G P S T E C 3 1 4 N o v e m b e r 2 8 , 2 0 1 7
  • 2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What is serverless? • No provisioning • Zero administration • High availability Fully managed • Focus on the code that matters • Innovate rapidly • Reduce time to market Developer productivity • Automatically • Scale up and scale down Continuous scaling
  • 3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monolithic application
  • 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Can’t fit a monolith inside Lambda Webserver Data Access Service App service Visualization Service Lambda function
  • 5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monolithic versus microservices vs
  • 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Original monolithic application Load Balancer Browser Database Webserver Data Access Service • On premises • Tightly coupled application components • Load balancer • Relational database App Service Visualization Service
  • 7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Hard to scale Can’t handle component failures Slow deployment process Limited options Limitations
  • 8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. How do we get there?
  • 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Transformation steps Discover Design Develop Deploy Refine
  • 10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 1. Identify components Visualization Service Webserver Data Access Service App Service Database 2. Outline requirements Amazon S3 Amazon DynamoDB AWS Lambda Amazon API Gateway 3. Map to AWS resources • State? • Compute? • API? • Storage? • Security? • Managed? • Estimated scale? • Others Where do we start? Discover
  • 11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Rough architecture—design Data stored in Amazon DynamoDB Dynamic content in AWS Lambda Amazon API Gateway Browser Amazon CloudFront Amazon S3
  • 12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. How do I secure it? Amazon API Gateway AWS Lambda Amazon S3 Amazon CloudFront Browser Amazon DynamoDB
  • 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Define our initial security posture Amazon API Gateway AWS Lambda Amazon DynamoDB Amazon S3 Amazon CloudFront • Bucket Policies • ACLs • OAI • Geo-Restriction • Signed Cookies • Signed URLs • DDOS IAM AuthZ IAM • Throttling • Caching • Usage Plans Browser
  • 14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monitoring your resources Amazon API Gateway AWS Lambda Amazon S3 Amazon CloudFront Browser Amazon DynamoDB
  • 15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monitoring your resources Amazon API Gateway AWS Lambda Amazon S3 Amazon CloudFront Browser Amazon DynamoDB • Access Logs in S3 Bucket • CloudWatch Metrics • Access Logs in S3 Bucket AWS CloudTrail Amazon CloudWatch • Custom CloudWatch Metrics & Alarms • Audit Log of All AWS API Calls • Latency • Count • Cache Hit/Miss • 4XX/5XX Errors • Invocations • Invocation Errors • Duration • Throttled Invocations • Throttled Reqs • Returned Bytes • Latency
  • 16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Frameworks—develop/deploy 1. AWS Serverless Application Model (SAM) 2. Serverless 3. Zappa 4. Chalice 5. Others
  • 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Serverless Application Model (SAM) AWS CloudFormation brings: • Infrastructure as code • Easy to provision and manage a collection of related AWS resources • Input .yaml file and output provisioned AWS resources • Optimized for infrastructure AWS SAM: • CloudFormation extension optimized for serverless • New serverless resources: functions, APIs, and tables • Supports anything CloudFormation supports • Open specification (Apache 2.0)
  • 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS SAM: Less complexity, more power 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 Properties: 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 responses: {} swagger: '2.0' CF template example—API triggering Lambda AWSTemplateFormatVersion: '2010-09-09’ Transform: AWS::Serverless-2016-10-31 Resources: GetHtmlFunction: Type: AWS::Serverless::Function Properties: CodeUri: s3://flourish-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 AWS SAM example—API triggering Lambda
  • 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Serverless app lifecycle management AWS Serverless Application Model (SAM) AWS Lambda Amazon API Gateway AWS CloudFormation Amazon S3 Amazon DynamoDB Package & Deploy Code/Packages/ Swagger Serverless Template Serverless Template w/CodeUri package deploy CI/CD Tools
  • 20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Demo + deep dive
  • 21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Please go here to vote—democlub.xyz
  • 22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Voting application—high level architecture Data stored in Amazon DynamoDB Dynamic content in AWS Lambda Amazon API Gateway Browser Amazon S3
  • 23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Browser AuthZ Amazon DynamoDB Amazon API Gateway • Throttling • Caching • Usage Plans AWS Lambda IAM IAM Amazon S3Amazon CloudFront • Bucket Policies • ACLs • OAI • Geo-Restriction • Signed Cookies • Signed URLs • DDOS Amazon Cognito Amazon Route 53 Detailed architecture AWS Lambda Amazon DynamoDB Streams IAM IAM Aggregation
  • 24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Resources Learning path (step by step guide)—https://aws.amazon.com/getting- started/serverless-web-app/ Serverless page—https://aws.amazon.com/serverless/ Serverless architecture best practices (on YouTube)—https://youtu.be/b7UMoc1iUYw Serverless Application Model (SAM) deep dive—https://youtu.be/e3lreqpWN0A AWS Lambda deep dive—https://youtu.be/dB4zJk_fqrU Developer Tooling—https://aws.amazon.com/serverless/developer-tools/
  • 25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Thank you!