© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Randall Hunt, Tech Evangelist and Software Engineer
#DevDays
Serverless Architectural
PatternsDevDays Germany 2018
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Session Objectives
• Monoliths to Microservices
• Key Serverless Concepts
• Event Processing Architectures
• Operational Automation Architectures
• Web Application Architectures
• Data Processing Architectures
• Streaming data with Kinesis
• IoT
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monolith to Microservices
Evolution of Business Logic
Monolith Microservices Functions
Splitting
Monoliths
Ten Years Ago
Splitting
Monoliths
Ten Years Ago
XML & SOAP
Splitting
Monoliths
TenFiveYears Ago
REST JSON
Fast binary
encodingsSplitting
Monoliths
Five Years Ago
Splitting
Monoliths
TenFive Years Ago
Microservices
Five Years Ago
Microservices
Five Years Agoto Functions
Amazon
Kinesis
Amazon API
Gateway
Amazon SNS
Amazon S3
Amazon
DynamoDB
Amazon
SQS
Standard building brick
services provide standardized
platform capabilities
Amazon SNS
Amazon S3
Amazon API
Gateway
Amazon
SQS
Amazon
Kinesis
Amazon
DynamoDB
Microservices
to Functions
Business Logic
Glue between
the bricks
Standard building brick
services provide standardized
platform capabilities
Amazon SNS
Amazon S3
Amazon API
Gateway
Amazon
SQS
Amazon
Kinesis
Amazon
DynamoDB
Microservices
to Functions
Amazon SNS
Amazon S3
Amazon API
Gateway
Amazon
SQS
Amazon
Kinesis
Amazon
DynamoDB
Microservices
to Functions
Amazon SNS
Amazon S3
Amazon API
Gateway
Amazon
SQS
Amazon
Kinesis
Amazon
DynamoDB
Microservices
to FunctionsEphemeral
Microservices
to
Functions
Ephemeral
Microservices
to
Amazon API
Gateway
Amazon
SQS
Functions
Ephemeral
Microservices
to
Amazon API
Gateway
Amazon
Kinesis
Amazon
DynamoDB
Functions
Ephemeral
Microservices
to
Amazon API
Gateway
Amazon SNS
Amazon S3
Functions
Ephemeral
Amazon SNS
Amazon S3
Amazon API
Gateway
Amazon
SQS
Amazon
Kinesis
Amazon
DynamoDB
Microservices
to
Functions
Ephemeral
When the system is
idle, it shuts down and
costs nothing to run
Evolution of Business Logic
Monolith Microservices Functions
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Key Serverless Concepts
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Spectrum of Compute Options
AWS
Lambda
Amazon
Kinesis
Amazon
S3
Amazon API
Gateway
Amazon
SQS
Amazon
DynamoDB
AWS IoT
Amazon
EMR
Amazon
ElastiCache
Amazon
RDS
Amazon
Redshift
Amazon ES
Managed Serverless
Amazon EC2
Microsoft SQL
Server
“On EC2”
Amazon
Cognito
Amazon
CloudWatch
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
No servers to provision
or manage
Scales with usage
Never pay for idle
Availability and fault
tolerance built in
Serverless means…
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Regional services
AZ1 AZ2 AZ3
Serverless Service
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Anatomy of a Lambda function
Handler() function
Function to be executed
upon invocation
Event object
Data sent during
Lambda Function
Invocation
Context object
Methods available to
interact with runtime
information (request ID,
log group, etc.)
def handler(event, context):
return {
"message": ”Hello World!",
"event": event
}
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Lambda execution model
Synchronous (push) Asynchronous (event) Stream-based
Amazon
API Gateway
AWS Lambda
function
Amazon
DynamoDB
Amazon
SNS
/api/hello
AWS Lambda
function
Amazon
S3
reqs
Amazon
Kinesis
changes
AWS Lambda
service
function
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Lambda Best Practices
• Minimize package size to necessities
• Separate the Lambda handler from core logic
• Use EnvironmentVariables to modify operational behavior
• Self-contain dependencies in your function package
• Leverage “Max Memory Used” to right-size your functions
• Delete large unused functions (75GB limit)
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
AWS X-Ray Integration with Serverless
• Lambda instruments incoming requests for
all supported languages
• Lambda runs the X-Ray daemon on all
languages with an SDK
var AWSXRay = require(‘aws-xray-sdk-core‘);
AWSXRay.middleware.setSamplingRules(‘sampling-rules.json’);
var AWS = AWSXRay.captureAWS(require(‘aws-sdk’));
S3Client = AWS.S3();
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
X-Ray Trace Example
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Chalice
awslabs/aws-serverless-express
awslabs/aws-serverless-java-container
Serverless Frameworks
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Event Processing Architecture
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Event driven
A B CEvent A on B triggers C
Invocation
Lambda functions
Action
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Event-driven platform
S3 event
notifications
DynamoDB
Streams
Kinesis
events
Cognito
events
SNS
events
Custom
events
CloudTrail
events
LambdaDynamoDB
Kinesis S3
Any custom
Invoked in response to events
- Changes in data
- Changes in state
Redshift
SNS
Access any service,
including your own
Such as…
Lambda functions
CloudWatch
events
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Event-driven actions
Lambda:
Resize Images
Users upload photos
S3:
Source Bucket
S3:
Destination Bucket
Triggered on
PUTs
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
AWS Step Functions:
Orchestrate a Serverless processing
workflow using AWS Lambda
https://github.com/awslabs/lambda-refarch-imagerecognition
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Operation Automation Architecture
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Automation characteristics
• Periodic jobs
• Event triggered workflows
• Enforce security policies
• Audit and notification
• Respond to alarms
• Extend AWS functionality
… All while being Highly Available, Scalable and Auditable
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Auto tagging resources as they start
AWS Lambda:
Update Tag
Amazon CloudWatch Events:
Rule Triggered
Amazon EC2 Instance
State Changes
Amazon DynamoDB:
EC2 Instance Properties
Tag: N/A
Amazon EC2 Instance
State Changes
Tag:
Owner=userName
PrincipalID=aws:userid
• AMI
• Instances
• Snapshot
• Volume
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
CapitalOne Cloud Custodian
AWS Lambda:
Policy & Compliance Rules
Amazon CloudWatch Events:
Rules Triggered
AWS CloudTrail:
Events
Amazon SNS:
Alert Notifications
Amazon CloudWatch Logs:
Logs
Read more here: http://www.capitalone.io/cloud-custodian/docs/index.html
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Scheduled backup operation
AWS Lambda:
Backup Rules
Amazon CloudWatch Events:
Scheduled Trigger
Amazon Redshift Cluster XYZ Snapshot
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Web Application Architecture
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Web application
Data stored in
Amazon
DynamoDB
Dynamic content
in AWS Lambda
Amazon API
Gateway
Browser
Amazon
CloudFront
Amazon
S3
Amazon
Cognito
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Amazon API
Gateway AWS
Lambda
Amazon
DynamoDB
Amazon
S3
Amazon
CloudFront
• Bucket Policies
• ACLs
• OAI
• Geo-Restriction
• Signed Cookies
• Signed URLs
• DDOS Protection
IAM
AuthZ
IAM
• Throttling
• Caching
• Usage Plans
• ACM
Browser
Amazon Cognito
Serverless web app security
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Amazon API
Gateway AWS
Lambda
Amazon
DynamoDB
Amazon
S3
Amazon
CloudFront
• Bucket Policies
• ACLs
• OAI
• Geo-Restriction
• Signed Cookies
• Signed URLs
• DDOS Protection
IAM
AuthZ
IAM
• Throttling
• Caching
• Usage Plans
• ACM
Browser
Amazon Cognito
Serverless web app security
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
CustomAuthorizer
Lambdafunction
Client
Lambda
function
AmazonAPI
Gateway
Amazon
DynamoDB
AWS Identity &
Access Management
SAML
Two types:
• TOKEN - authorization token passed
in a header
• REQUEST – all headers, query strings,
paths, stage variables or context
variables.
Custom Authorizers
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Bustle Achieves 84% Cost Savings with AWS
Lambda
Bustle is a news, entertainment, lifestyle, and fashion
website targeted towards women.
With AWS Lambda, we
eliminate the need to worry
about operations
Tyler Love
CTO, Bustle
”
“ • Bustle had trouble scaling and maintaining
high availability for its website without
heavy management
• Moved to serverless architecture using
AWS Lambda and Amazon API Gateway
• Experienced approximately 84% in cost
savings
• Engineers are now focused on innovation
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Serverless Web Application Frameworks
• Zappa, Chalice
• Serverless, Claudia
• Let’s see a quick demo
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Data Processing Architecture
Kinesis-based apps
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Amazon Kinesis makes it easy to work with real-
time streaming data
Amazon Kinesis
Streams
• For Technical Developers
• Collect and stream data
for ordered, replay-able,
real-time processing
Amazon Kinesis
Firehose
• For all developers, data
scientists
• Easily load massive
volumes of streaming data
into Amazon S3, Redshift,
ElasticSearch
Amazon Kinesis
Analytics
• For all developers, data
scientists
• Easily analyze data
streams using standard
SQL queries
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Producers Consumers
Shard 1
Shard 2
Shard n
Shard 3
…
…
Write: 1MB Read: 2MB
** A shard is a group of data records in a stream
Amazon Kinesis
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Amazon Kinesis under the hood
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Producers Amazon S3
Amazon ES
Amazon Redshift
Amazon Kinesis Firehose
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunthttps://aws.amazon.com/solutions/case-studies/supercell/
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Real-time analytics
Amazon
Kinesis
Stream
Amazon
Kinesis
Analytics
Amazon
Cognito
Amazon
Kinesis
Stream
Amazon
DynamoDB
Amazon
Lambda
AmazonS3
JavaScriptSDK
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Processing a Kinesis Streams with AWS Lambda
Shard 1 Shard 2 Shard 3 Shard 4 Shard n
Kinesis Stream
. . .
. . .
• Single instance of Lambda function per shard
• Polls shard once per second
• Lambda function instances created and removed automatically as stream is scaled
Gets Records
1x per sec
10k records
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
Further Reading
Optimizing Enterprise Economics with Serverless Architectures
https://d0.awsstatic.com/whitepapers/optimizing-enterprise-economics-serverless-architectures.pdf
Serverless Architectures with AWS Lambda
https://d1.awsstatic.com/whitepapers/serverless-architectures-with-aws-lambda.pdf
Serverless Applications Lens - AWS Well-Architected Framework
https://d1.awsstatic.com/whitepapers/architecture/AWS-Serverless-Applications-Lens.pdf
Streaming Data Solutions on AWS with Amazon Kinesis
https://d1.awsstatic.com/whitepapers/whitepaper-streaming-data-solutions-on-aws-with-amazon-kinesis.pdf
AWS Serverless Multi-Tier Architectures
https://d1.awsstatic.com/whitepapers/AWS_Serverless_Multi-Tier_Archiectures.pdf
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @jrhunt
More info:
https://aws.amazon.com/serverless/

Serverless Architectural Patterns I AWS Dev Day 2018

  • 1.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Randall Hunt, Tech Evangelist and Software Engineer #DevDays Serverless Architectural PatternsDevDays Germany 2018
  • 2.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Session Objectives • Monoliths to Microservices • Key Serverless Concepts • Event Processing Architectures • Operational Automation Architectures • Web Application Architectures • Data Processing Architectures • Streaming data with Kinesis • IoT
  • 3.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monolith to Microservices
  • 4.
    Evolution of BusinessLogic Monolith Microservices Functions
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 13.
  • 15.
    Microservices Five Years AgotoFunctions Amazon Kinesis Amazon API Gateway Amazon SNS Amazon S3 Amazon DynamoDB Amazon SQS Standard building brick services provide standardized platform capabilities
  • 16.
    Amazon SNS Amazon S3 AmazonAPI Gateway Amazon SQS Amazon Kinesis Amazon DynamoDB Microservices to Functions Business Logic Glue between the bricks Standard building brick services provide standardized platform capabilities
  • 17.
    Amazon SNS Amazon S3 AmazonAPI Gateway Amazon SQS Amazon Kinesis Amazon DynamoDB Microservices to Functions
  • 18.
    Amazon SNS Amazon S3 AmazonAPI Gateway Amazon SQS Amazon Kinesis Amazon DynamoDB Microservices to Functions
  • 19.
    Amazon SNS Amazon S3 AmazonAPI Gateway Amazon SQS Amazon Kinesis Amazon DynamoDB Microservices to FunctionsEphemeral
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
    Amazon SNS Amazon S3 AmazonAPI Gateway Amazon SQS Amazon Kinesis Amazon DynamoDB Microservices to Functions Ephemeral When the system is idle, it shuts down and costs nothing to run
  • 25.
    Evolution of BusinessLogic Monolith Microservices Functions
  • 26.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Key Serverless Concepts
  • 27.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Spectrum of Compute Options AWS Lambda Amazon Kinesis Amazon S3 Amazon API Gateway Amazon SQS Amazon DynamoDB AWS IoT Amazon EMR Amazon ElastiCache Amazon RDS Amazon Redshift Amazon ES Managed Serverless Amazon EC2 Microsoft SQL Server “On EC2” Amazon Cognito Amazon CloudWatch
  • 28.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt No servers to provision or manage Scales with usage Never pay for idle Availability and fault tolerance built in Serverless means…
  • 29.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Regional services AZ1 AZ2 AZ3 Serverless Service
  • 30.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Anatomy of a Lambda function Handler() function Function to be executed upon invocation Event object Data sent during Lambda Function Invocation Context object Methods available to interact with runtime information (request ID, log group, etc.) def handler(event, context): return { "message": ”Hello World!", "event": event }
  • 31.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Lambda execution model Synchronous (push) Asynchronous (event) Stream-based Amazon API Gateway AWS Lambda function Amazon DynamoDB Amazon SNS /api/hello AWS Lambda function Amazon S3 reqs Amazon Kinesis changes AWS Lambda service function
  • 32.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Lambda Best Practices • Minimize package size to necessities • Separate the Lambda handler from core logic • Use EnvironmentVariables to modify operational behavior • Self-contain dependencies in your function package • Leverage “Max Memory Used” to right-size your functions • Delete large unused functions (75GB limit)
  • 33.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt AWS X-Ray Integration with Serverless • Lambda instruments incoming requests for all supported languages • Lambda runs the X-Ray daemon on all languages with an SDK var AWSXRay = require(‘aws-xray-sdk-core‘); AWSXRay.middleware.setSamplingRules(‘sampling-rules.json’); var AWS = AWSXRay.captureAWS(require(‘aws-sdk’)); S3Client = AWS.S3();
  • 34.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt X-Ray Trace Example
  • 35.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Chalice awslabs/aws-serverless-express awslabs/aws-serverless-java-container Serverless Frameworks
  • 36.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Event Processing Architecture
  • 37.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Event driven A B CEvent A on B triggers C Invocation Lambda functions Action
  • 38.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Event-driven platform S3 event notifications DynamoDB Streams Kinesis events Cognito events SNS events Custom events CloudTrail events LambdaDynamoDB Kinesis S3 Any custom Invoked in response to events - Changes in data - Changes in state Redshift SNS Access any service, including your own Such as… Lambda functions CloudWatch events
  • 39.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Event-driven actions Lambda: Resize Images Users upload photos S3: Source Bucket S3: Destination Bucket Triggered on PUTs
  • 40.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt AWS Step Functions: Orchestrate a Serverless processing workflow using AWS Lambda
  • 41.
  • 42.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Operation Automation Architecture
  • 43.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Automation characteristics • Periodic jobs • Event triggered workflows • Enforce security policies • Audit and notification • Respond to alarms • Extend AWS functionality … All while being Highly Available, Scalable and Auditable
  • 44.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Auto tagging resources as they start AWS Lambda: Update Tag Amazon CloudWatch Events: Rule Triggered Amazon EC2 Instance State Changes Amazon DynamoDB: EC2 Instance Properties Tag: N/A Amazon EC2 Instance State Changes Tag: Owner=userName PrincipalID=aws:userid • AMI • Instances • Snapshot • Volume
  • 45.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt CapitalOne Cloud Custodian AWS Lambda: Policy & Compliance Rules Amazon CloudWatch Events: Rules Triggered AWS CloudTrail: Events Amazon SNS: Alert Notifications Amazon CloudWatch Logs: Logs Read more here: http://www.capitalone.io/cloud-custodian/docs/index.html
  • 46.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Scheduled backup operation AWS Lambda: Backup Rules Amazon CloudWatch Events: Scheduled Trigger Amazon Redshift Cluster XYZ Snapshot
  • 47.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Web Application Architecture
  • 48.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Web application Data stored in Amazon DynamoDB Dynamic content in AWS Lambda Amazon API Gateway Browser Amazon CloudFront Amazon S3 Amazon Cognito
  • 49.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Amazon API Gateway AWS Lambda Amazon DynamoDB Amazon S3 Amazon CloudFront • Bucket Policies • ACLs • OAI • Geo-Restriction • Signed Cookies • Signed URLs • DDOS Protection IAM AuthZ IAM • Throttling • Caching • Usage Plans • ACM Browser Amazon Cognito Serverless web app security
  • 50.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Amazon API Gateway AWS Lambda Amazon DynamoDB Amazon S3 Amazon CloudFront • Bucket Policies • ACLs • OAI • Geo-Restriction • Signed Cookies • Signed URLs • DDOS Protection IAM AuthZ IAM • Throttling • Caching • Usage Plans • ACM Browser Amazon Cognito Serverless web app security
  • 51.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt CustomAuthorizer Lambdafunction Client Lambda function AmazonAPI Gateway Amazon DynamoDB AWS Identity & Access Management SAML Two types: • TOKEN - authorization token passed in a header • REQUEST – all headers, query strings, paths, stage variables or context variables. Custom Authorizers
  • 52.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Bustle Achieves 84% Cost Savings with AWS Lambda Bustle is a news, entertainment, lifestyle, and fashion website targeted towards women. With AWS Lambda, we eliminate the need to worry about operations Tyler Love CTO, Bustle ” “ • Bustle had trouble scaling and maintaining high availability for its website without heavy management • Moved to serverless architecture using AWS Lambda and Amazon API Gateway • Experienced approximately 84% in cost savings • Engineers are now focused on innovation
  • 53.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Serverless Web Application Frameworks • Zappa, Chalice • Serverless, Claudia • Let’s see a quick demo
  • 54.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Data Processing Architecture Kinesis-based apps
  • 55.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Amazon Kinesis makes it easy to work with real- time streaming data Amazon Kinesis Streams • For Technical Developers • Collect and stream data for ordered, replay-able, real-time processing Amazon Kinesis Firehose • For all developers, data scientists • Easily load massive volumes of streaming data into Amazon S3, Redshift, ElasticSearch Amazon Kinesis Analytics • For all developers, data scientists • Easily analyze data streams using standard SQL queries
  • 56.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Producers Consumers Shard 1 Shard 2 Shard n Shard 3 … … Write: 1MB Read: 2MB ** A shard is a group of data records in a stream Amazon Kinesis
  • 57.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Amazon Kinesis under the hood
  • 58.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Producers Amazon S3 Amazon ES Amazon Redshift Amazon Kinesis Firehose
  • 59.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt
  • 60.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunthttps://aws.amazon.com/solutions/case-studies/supercell/
  • 61.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt
  • 62.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Real-time analytics Amazon Kinesis Stream Amazon Kinesis Analytics Amazon Cognito Amazon Kinesis Stream Amazon DynamoDB Amazon Lambda AmazonS3 JavaScriptSDK
  • 63.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Processing a Kinesis Streams with AWS Lambda Shard 1 Shard 2 Shard 3 Shard 4 Shard n Kinesis Stream . . . . . . • Single instance of Lambda function per shard • Polls shard once per second • Lambda function instances created and removed automatically as stream is scaled Gets Records 1x per sec 10k records
  • 64.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt Further Reading Optimizing Enterprise Economics with Serverless Architectures https://d0.awsstatic.com/whitepapers/optimizing-enterprise-economics-serverless-architectures.pdf Serverless Architectures with AWS Lambda https://d1.awsstatic.com/whitepapers/serverless-architectures-with-aws-lambda.pdf Serverless Applications Lens - AWS Well-Architected Framework https://d1.awsstatic.com/whitepapers/architecture/AWS-Serverless-Applications-Lens.pdf Streaming Data Solutions on AWS with Amazon Kinesis https://d1.awsstatic.com/whitepapers/whitepaper-streaming-data-solutions-on-aws-with-amazon-kinesis.pdf AWS Serverless Multi-Tier Architectures https://d1.awsstatic.com/whitepapers/AWS_Serverless_Multi-Tier_Archiectures.pdf
  • 65.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. @jrhunt More info: https://aws.amazon.com/serverless/

Editor's Notes

  • #56 Since Amazon Kinesis launch in 2013, the ecosystem evolved and we introduced Kinesis Firehose and Kinesis Analytics. Streams was launched in GA at re:Invent 2014, Firehose at re:Invent 2015, and Analytics was launched in August 2016 We have continuously iterated to make it easier for customers to use streaming data, as well as expand the functionality of real-time processing Together, these three products make up the Amazon Kinesis streaming data platform
  • #57 A shard is a group of data records in a stream. When you create a stream, you specify the number of shards for the stream. Each shard can support up to 5 transactions per second for reads, up to a maximum total data read rate of 2 MB per second and up to 1,000 records per second for writes, up to a maximum total data write rate of 1 MB per second (including partition keys). The total capacity of a stream is the sum of the capacities of its shards. You can increase or decrease the number of shards in a stream as needed. However, note that you are charged on a per-shard basis.
  • #61 Since Amazon Kinesis launch in 2013, the ecosystem evolved and we introduced Kinesis Firehose and Kinesis Analytics. Streams was launched in GA at re:Invent 2014, Firehose at re:Invent 2015, and Analytics was launched in August 2016 We have continuously iterated to make it easier for customers to use streaming data, as well as expand the functionality of real-time processing Together, these three products make up the Amazon Kinesis streaming data platform
  • #62 Netflix’s Amazon Kinesis Streams-based solution has proven to be highly scalable, each day processing billions of traffic flows. Typically, about 1,000 Amazon Kinesis shards work in parallel to process the data stream. “Amazon Kinesis Streams processes multiple terabytes of log data each day, yet events show up in our analytics in seconds,” says Bennett. “We can discover and respond to issues in real time, ensuring high availability and a great customer experience.”
  • #64 AWS Lambda is a compute service that runs your code in response to events and automatically manages the compute resources for you, making it easy to build applications that respond quickly to new information. AWS Lambda starts running your code within milliseconds of an event such as an image upload, in-app activity, website click, or output from a connected device. You can also use AWS Lambda to create new back-end services where compute resources are automatically triggered based on custom requests. With AWS Lambda you pay only for the requests served and the compute time required to run your code. Billing is metered in increments of 100 milliseconds, making it cost-effective and easy to scale automatically from a few requests per day to thousands per second.