Más contenido relacionado La actualidad más candente (20) Similar a Thirty Serverless Architectures in 30 Minutes - SRV325 - Chicago AWS Summit (20) Más de Amazon Web Services (20) Thirty Serverless Architectures in 30 Minutes - SRV325 - Chicago AWS Summit1. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Angela Wang – AWS Solutions Architect
Thirty Serverless Architectures in
30 Minutes
2. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Angela Wang – AWS Solutions Architect
Thirty Serverless Architectures in
30 MinutesX
X
3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
https://secure.flickr.com/photos/mgifford/4525333972
Why are we
here today?
4. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
No servers to provision
or manage
Scales with usage
Never pay for idle Availability and fault tolerance
built in
Serverless means …
5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Serverless applications
Services (anything)
Changes in
data state
Requests to
endpoints
Changes in
resource state
Event source Function
Node.js
Python
Java
C#
Go
6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Common use cases for AWS Lambda
Web
applications
• Static websites
• Complex web
apps
• Packages for
Flask and
Express
Data
processing
• Real time
• MapReduce
• Batch
Chatbots
• Powering
chatbot logic
Backends
• Apps & services
• Mobile
• IoT
</></>
Amazon Alexa
• Powering
voice-enabled
apps
• Alexa Skills Kit
IT automation
• Policy engines
• Extending AWS
services
• Infrastructure
management
7. Lambda execution models
Synchronous (push) Asynchronous (event) Poll-Based
Amazon
API Gateway
Lambda
function
Amazon
DynamoDBAmazon
SNS
/order
Lambda
function
Amazon
S3
reqs
Amazon Kinesis
changes
Lambda service
function
8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda execution models
Poll-based
Amazon SQS
Messages
AWS Lambda
service
Lambda function
New New
9. Lambda permissions model
Fine-grained security controls for both execution
and invocation:
Execution policies:
• Define what AWS resources/API calls can this
function access via IAM
• Used in streaming invocations
• E.g., “Lambda function A can read from DynamoDB
table users”
Function policies:
• Used for sync and async invocations
• E.g., “Actions on bucket X can invoke Lambda
function Z"
• Resource policies allow for cross-account access
10. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s
https://secure.flickr.com/photos/stevendepolo/5749192025/!
11. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon S3
bucket
object
Lambda
function
1. File put into bucket
2. Lambda invoked
Lambda
function
2. Lambda invoked
SNS
topic
1. Data published to a topic
Data
1. Lambda directly invoked
via invoke API
SDK clients
Lambda
function
12. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
1. Message inserted into
to a queue
Message
Amazon
SQS
Lambda
function
3. Function
removes message
from queue
2. Lambda polls
queue and invokes
function
New New
13. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda
function
2. Lambda function
invoked
1. API call made against
API Gateway
API clients
Amazon API
Gateway
Lambda
function
Lambda
function
2. API call is made
directly against backing
AWS service
Amazon API
Gateway
API clients
Amazon
S3
Amazon
Kinesis
Amazon
DynamoDB
etc.
1. API call made against
API Gateway
Lambda
function
2. Lambda authorizer
function invoked
1. API call made against API
Gateway where API is
configured for a Lambda
Authorizer
API clients
Amazon API
Gateway
3. Lambda responds with results
and if successful API Gateway
proceeds with an API backend
call
14. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda
function
2. Lambda@Edge function
invoked
1. HTTP/S request made to
CloudFront-based domain
HTTPrequest
Amazon
CloudFront
Lambda
function
2+. Lambda
function(s) invoked
1. Step Functions workflow
is executed
Lambda
function
Lambda
function
AWS Step
Functions
Event
2. AWS Step Functions
workflow is executed
1. API call made against
API Gateway
Amazon API
Gateway
API clients
Step Functions
15. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda
function
2. Lambda invoked via rule
1. Error message gets sent
back to Amazon SES on
delivery attempt
Amazon
SES
Email failure
notification
Lambda
function
2. Lambda invoked per
matching trigger
1. User performs action
with trigger set
Amazon
Cognito
Users
Lambda
function
2. Lambda function
invoked
1. GraphQL call made
against AWS AppSync
GraphQL API
clients
AWS AppSync
16. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda
function
2. Lambda polls
stream
Amazon
KinesisData
Streams
1. Data published to a
stream
3. Kinesis returns
stream data
Data
Data
Amazon
KinesisData
Analytics
Lambda
function
SQLQuery
Amazon
KinesisData
Streams/
Firehose
Amazon
KinesisData
Streams/
Firehose
Lambda
function
1. Data published to a
stream
2. Stream passes to
Kinesis Data Analytics
3. Lambda invoked to
pre-process data
4. SQL query run on
processed data
5. Analytics output
sent back to
Streams/Firehose 6. Lambda invoked
per poll model to the
left
17. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda
function
1. Deployment event
is sent to SNS topic
AWS
CodeDeploy
Lambda
function
2. AWS CodePipeline executed
Application
code
1. Code committed
3. Lambda function
invoked via stage action
2. Lambda invoked via
SNS configuration
SNS topic
Lambda
function
3. Lambda invoked
Application
code
1. Code repository event
AWS
CodeCommit
2. Event trigger tripped
18. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
"AMIGetter": {
"Type": "Custom::AMIGetter",
"Properties": {
"ServiceToken": { "Fn::Join": [ "", [
"arn:aws:lambda:", { "Ref": "AWS::Region" },
":", { "Ref": "AWS::AccountId" }, ":function:",
"AMIGetter" ] ] },
….
Lambda
function
2. Lambda invoked
1. Custom resource
executed
AWS CloudFormation
template
Lambda
function
2. Amazon S3 publishes
event to Lambda
1. AWS API calls logged to
an object in
Amazon S3
AWS
CloudTrail
S3 bucket
3. Lambda invoked,
processes object in
Amazon S3
Lambda
function
2. Change sent to Amazon
SNS topic
1. AWS resource changed
AWS
Config
SNS topic
3. Lambda invoked
19. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda
function
2. Lambda invoked via rule
Changeevent
1. AWS resource changed or
periodic execution
Config rule
Lambda
function
2. Lambda invoked via rule
Serviceevent
1. Service event or CWE
Bus API call
Amazon CloudWatch
Events (event-based)
Lambda
function
1. Scheduled time
occurs
CloudWatch Events
(time-based)
2. Lambda invoked
20. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda
function
3. Lambda invoked
Metricdata
1. Metric data collected
by CloudWatch
CloudWatch
2. Alarm threshold
breached
Lambda
function
3. Lambda invoked
Logs
1. Logs collected by
Amazon CloudWatch
Logs
Amazon
CloudWatch
2. Logs passed on
21. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
1. items inserted,
updated, or deleted
Lambda
function
3. Lambda polls
stream
Amazon
Kinesis
Streams
4. Kinesis
returns stream
data
items
DynamoDB
table
2. Event published to
Amazon Kinesis Data
Streams
Lambda
function
3. Lambda invoked
1. Query executed
Amazon
Aurora - MySQL
SQLquery
2. Stored procedure
called
Lambda
function
3. Lambda invoked
1. Amazon Redshift
event occurs
Amazon
Redshift
SNS topic
2. Event sent to SNS topic
22. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
2. Lambda invoked
1. Chatbot conversation
needs “fulfillment”
Lambda
function
Amazon
Lex
Chatbot
Lambda
function
2. Lambda invoked
1. Alexa, what’s today’s
weather?
Alexa skill
Alexa compatible
device
Lambda
function
2. Lambda invoked
1. IoT device sends data
IoT device
AWS IoT
23. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
FIN, ACK
• From full fledged application backends to “glue” functions
attached to operational tasks
• Removes the need to run hosts for small scripts such as cron
jobs and small web services, with many benefits:
• Reduced cost
• Reduced maintenance overhead
• No capacity planning needed for potential spikes in usage
• Security model that allows for finely scoped access and permissions
• Use AWS SAM to deploy
• Can get started right in the console or via AWS CodeStar
There are a lot of different use cases for Lambda
24. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
25. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
aws.amazon.com/serverless
26. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Submit session feedback
1. Tap the Schedule icon.
2. Select the session you attended.
3. Tap Session Evaluation to submit
your feedback.
27. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank you!