Mais conteúdo relacionado Semelhante a SRV213-Thirty Serverless Architectures in 30 Minutes (20) Mais de Amazon Web Services (20) SRV213-Thirty Serverless Architectures in 30 Minutes1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thirty Serverless Architectures
in 30 Minutes
C h r i s M u n n s – S e n i o r D e v e l o p e r A d v o c a t e - S e r v e r l e s s
N o v e m b e r 2 7 , 2 0 1 7
S R V 2 1 3
AWS re:Invent
2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
About me:
Chris Munns - munns@amazon.com, @chrismunns
• Senior Developer Advocate—Serverless
• New Yorker
• Previously:
• AWS Business Development Manager – DevOps, July ’15 - Feb ‘17
• AWS Solutions Architect Nov, 2011 - Dec 2014
• Formerly on operations teams @Etsy and @Meetup
• Little time at a hedge fund, Xerox, and a few other startups
• Rochester Institute of Technology: Applied Networking and Systems
Administration ’05
• Internet infrastructure geek
6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
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
7. © 2017, 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
HTTP
request
Amazon
CloudFront
Lambda
function
2+. Lambda
function(s) invoked
1. Step Functions
workflow is executed
Lambda
function
Lambda
function
AWS Step
Functions
Event
8. © 2017, 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 made directly
against backing AWS service
API clients
Amazon API
Gateway
API clients
Amazon
S3
Amazon
Kinesis
Amazon
DynamoDB
etc..
2. Step Functions
workflow is executed
1. API call made
against API Gateway
Amazon API
Gateway
API clients
AWS Step
Functions
1. API call made
against API Gateway
9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lambda
function
2. Lambda invoked via rule
1. Error message gets sent
back to SES on delivery
attempt
Amazon
SES
Email failure
notification
Lambda
function
2. Message sent to SNS
SNS
Topic
1. An Auto Scaling event
occurs triggering a lifecycle
hook
Auto Scaling
3. Lambda invoked
Lambda
function
2. Lambda invoked
per matching trigger
1. User performs
action with trigger set
Amazon
Cognito
Users
10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lambda
function
2. Lambda polls
stream
Amazon
Kinesis
Stream
1. Data published to a
stream
3. Kinesis returns
stream data
Data
Data
Amazon
Kinesis
Analytics
Lambda
function
SQL Query
Amazon
Kinesis
Stream /
Firehose
Amazon
Kinesis
Stream /
Firehose
Lambda
function
1. Data published to a
stream
2. Stream passes to
Kinesis Analytics
3. Lambda invoked to
pre-process data
4. SQL query run on
processed data
5. Analytics output
sent back to
Stream/Firehose 6. Lambda invoked
per poll model to
the left
11. © 2017, 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. 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
12. © 2017, 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. S3 publishes
event to Lambda
1. AWS API calls logged
to an object in S3
AWS
CloudTrail
S3
bucket
3. Lambda invoked,
processes object in
S3
Lambda
function
2. Change sent to SNS
Topic
1. AWS resource changed
Amazon
Config
SNS
Topic
3. Lambda invoked
13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lambda
function
2. Lambda invoked via
rule
Change
Event
1. AWS resource changed
or periodic execution
AWS Config
Rule
Lambda
function
2. Lambda invoked via
rule
Service
Event
1. Service Event or CWE
Bus API call
CloudWatch
Events
(event-based)
Lambda
function
1. Scheduled time
occurs
CloudWatch
Events
(time-based)
2. Lambda invoked
14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lambda
function
3. Lambda invoked
Metric Data
1. Metric data collected
by CloudWatch
Amazon
CloudWatch
2. Alarm threshold
breached
Lambda
function
3. Lambda invoked
Logs
1. Logs collected by
CloudWatch Logs
Amazon
CloudWatch
2. Logs passed on
15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
1. Items inserted/
updated/deleted
Lambda
function
3. Lambda polls
stream
Amazon
Kinesis
Stream
4. Kinesis
returns
stream data
Items
DynamoDB
Table
2. Event published
to Kinesis Stream
Lambda
function
3. Lambda invoked
1. Query executed
Amazon
Aurora - MySQL
SQL Query
2. Stored
procedure called
Lambda
function
3. Lambda invoked
1. Amazon Redshift
Event occurs
Amazon
Redshift
SNS
Topic
2. Event sent to SNS
Topic
16. © 2017, 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
17. 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 (Serverless Application Models) to deploy!
• Can get started right in the console or via AWS CodeStar!
There are a lot of different use-cases for AWS Lambda!
20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you!
R e m e m b e r t o r e v i e w t h i s s e s s i o n !
S R V 2 1 3