serverless architecture hochskalierbare anwendungen ohne...
TRANSCRIPT
Serverless Architecture – Hochskalierbare Anwendungen ohne
Server
Sascha Möllering,
Solutions Architect
Agenda
• Serverless Architecture
• AWS Lambda
• Amazon API Gateway
• Amazon DynamoDB
• Amazon S3
• Serverless Framework
• Q&A
Background
How serverless architecture patterns with AWS Lambda are the next evolution of application design
The Monolithic Architecture
The Service-Oriented Architecture
Presentation Tier Logic Tier
Data Tier
The Microservices Architecture
Why serverless architectures?
• No servers to manage and scale
• Run at scale
• Respond quickly to events
• Only pay for compute time that you use
• Developer productivity
Serverless microservice architecture
Amazon S3
Static Content
AWS Lambda
Backend Logic
Web client
End user
Amazon API Gateway
REST Interface
Amazon
DynamoDB
Messages Data Store
AWS Lambda
AWS compute offerings
Amazon EC2Resizable virtual
servers in the
cloud
Amazon ECSContainer management
service for running
Docker on EC2
AWS LambdaServerless compute, run
code in response to
events
Benefits of using Lambda
Continuous ScalingNo Servers to Manage
Lambda automatically
scales your application by
running code in response
to each trigger. Your code
runs in parallel and
processes each trigger
individually, scaling
precisely with the size of
the workload.
Subsecond Metering
With Lambda, you are
charged for every
100 ms your code
executes and the number
of times your code is
triggered. You don’t pay
anything when your code
isn’t running.
Lambda automatically
runs your code without
requiring you to provision
or manage servers. Just
write the code and
upload it to Lambda.
AWS Lambda – How it works
Bring your own code
• Node.js, Java, Python
• Java = Any JVM based
language such as Scala,
Clojure, etc.
• Bring your own libraries
Flexible invocation paths
• Event or RequestResponse
invoke options
• Existing integrations with
various AWS services
Simple resource model
• Select memory from 128MB
to 1.5GB in 64MB steps
• CPU & Network allocated
proportionately to RAM
• Reports actual usage
Fine grained permissions
• Uses IAM role for Lambda
execution permissions
• Uses Resource policy for
AWS event sources
AWS Lambda – Use Cases
Data ProcessingExecute code in response
to changes in data, shifts in system state, or actions by
users
Control SystemsCustomize responses and
response workflows to state and data changes
within AWS
BackendsExecute backend logic to handle requests for web, mobile, IoT, and 3rd APIs
Amazon API Gateway
Benefits of Amazon API Gateway
Create a unified API
front end for
multiple
microservices
DDoS protection
and throttling for
back-end systems
Authenticate and
authorize requests
Benefits of Amazon API Gateway
• Managed cache to store API responses
• Reduced latency and distributed denial of service (DDoS) protection
through Amazon CloudFront
• SDK generation for iOS, Android, and JavaScript
• Swagger support
• Request and response data transformation
An API call flow
Internet
Mobile apps
Websites
Services
AWS Lambda
functions
AWS
API Gateway
cache
Endpoints on
Amazon
EC2/AWS
Elastic
Beanstalk
Any other publicly
accessible endpointAmazon
CloudWatch
monitoring
API Gateway
Amazon DynamoDB
Fast, Consistent Performance
• Single-digit millisecond latency
– At any scale
• Data stored on Solid State Drives (SSDs)
• Automatic partitioning means no need for
hotspot management
Highly Scalable
• Simply specify each table’s read and
write
throughput capacity
• Increase and decrease capacity as
needed
– No upper limit
• DynamoDB manages all the scaling
behind the scenes
Flexible
Key-value store model
• Each item in a DynamoDB
table is a list of attributes
(fields) and values
• No need for every item to have
the same attributes
• Add attributes at will
Document store
• Place JSON-formatted data
into DynamoDB items for
robust, nested data structures
Amazon DynamoDB is a schemaless database
table items
Attributes (name/value pairs or JSON documents)
Amazon S3
Amazon S3 - Features
SecureData transfer over SSL,
bucket policies to manage object permissions
Available Designed for up to 99.99%
availability
DurableDurability of
99.999999999% of objects
Amazon S3 - Website Hosting
• Host static websites on Amazon S3
• HTML + JS + CSS
• Use JS to communicate with Amazon API Gateway
Amazon S3 - Website Hosting
Serverless Framework
• Open-source application framework
• Build serverless architectures
• Manages your code as well as your infrastructure (AWS
CloudFormation)
• Supports multiple languages (Node.js, Python, Java, Scala)
Serverless Framework
• Functions: AWS Lambda function, independent unit of deployment
• Events: Anything that triggers an AWS Lambda Function
• Resources: AWS infrastructure components which your Functions use
• Service: Framework's unit of organization (project file)
• Plugin: overwrite or extend the functionality of the Framework
Serverless Framework
• serverless.yml: Contains Resources
• src/*: Contains Functions
• package.json: Dependencies
• event.json: Test event (local testing)
Demo
Summary
• Serverless Architecture is cost effective and highly scalable
• Focus on business success
• Increased developer productivity
A Call to Action
Go build something!
Amazon API Gateway
AWS Lambda AmazonDynamoDB
aws.amazon.com/de/activate/
Everything and Anything Startups
Need to Get Started on AWS