Elastic Load Balancing Deep Dive and Best Practices - Pop-up Loft Tel Aviv
Event-Driven Serverless Apps - Pop-up Loft Tel Aviv
-
Upload
amazon-web-services -
Category
Technology
-
view
311 -
download
2
Transcript of Event-Driven Serverless Apps - Pop-up Loft Tel Aviv
![Page 1: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/1.jpg)
Event-‐Driven Serverless AppsDanilo Poccia, Technical Evangelist
@danilop
![Page 2: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/2.jpg)
Event-Driven in the Front End
![Page 3: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/3.jpg)
Name
Create New User
Submit
Check the “Name” syntax is right (only letters and spaces)
Check the “Email” syntax is right ([email protected])
Create the new user using provided Name and Email
User Interface Actions
![Page 4: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/4.jpg)
Name
Create New User
Submit
Check the “Name” syntax is right (only letters and spaces)
Check the “Email” syntax is right ([email protected])
Create the new user using provided Name and Email
User Interface ActionsObservers
Target Action
![Page 5: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/5.jpg)
What about the Back End ?
![Page 6: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/6.jpg)
! Users
![Page 7: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/7.jpg)
Internet
! Users
![Page 8: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/8.jpg)
Back End Logic
Internet
! Users
![Page 9: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/9.jpg)
Back End Data
Back End Logic
Internet
! Users
![Page 10: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/10.jpg)
Back End Data
Application Back End
Back End Logic
Internet
! Users
![Page 11: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/11.jpg)
Application Back End" Web Browsers
Back End Data
Back End Logic
![Page 12: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/12.jpg)
Application Back End" Web Browsers
# Mobile Apps Back End
Data
Back End Logic
![Page 13: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/13.jpg)
Application Back End" Web Browsers
# Mobile Apps
$ IoT Devices
Back End Data
Back End Logic
![Page 14: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/14.jpg)
Application Back End" Web Browsers
# Mobile Apps
$ IoT Devices
% Other Services
Back End Data
Back End Logic
![Page 15: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/15.jpg)
Application Back End
Files
Databases
" Web Browsers
# Mobile Apps
$ IoT Devices
% Other Services
Back End Logic
![Page 16: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/16.jpg)
HTML, CSS, JavaScript & Multimedia Content
API Calls
Application Back End" Web Browsers
# Mobile Apps
$ IoT Devices
% Other Services
Files
Databases
Back End Logic
![Page 17: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/17.jpg)
API Calls
Application Back End
HTML, CSS, JavaScript & Multimedia Content
" Web Browsers
(JavaScript)
# Mobile Apps
$ IoT Devices
% Other Services
By using JavaScript, Web Browsers can behave
like the other clients, such as Mobile Apps
or IoT Devices
Files
Databases
Back End Logic
![Page 18: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/18.jpg)
API Calls
Application Back End
HTML, CSS, JavaScript & Multimedia Content
" Web Browsers
(JavaScript)
# Mobile Apps
$ IoT Devices
% Other Services
Files
Databases
Back End Logic
![Page 19: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/19.jpg)
Client Application
API Calls
Application Back End
HTML, CSS, JavaScript & Multimedia Content
The Client Application can be a Web Browser,
a Mobile App, an IoT Device,
or another Service
We can now decouple the back end implementation
from the device used by our users
Files
Databases
Back End Logic
![Page 20: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/20.jpg)
Client Application
API Calls
Application Back End
HTML, CSS, JavaScript & Multimedia Content
The Client Application can be a Web Browser,
a Mobile App, an IoT Device,
or another Service
Files
Databases
Back End Logic
![Page 21: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/21.jpg)
Introducing AWS Lambda
![Page 22: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/22.jpg)
Context
Function
Event AWS Lambda
Result
RequestResponse Function
Invocation
Lambda API Call
Synchronous Invocations
![Page 23: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/23.jpg)
Context
Function
Event AWS Lambda
Event Function
Invocation
Lambda API Call
Asynchronous Invocations
![Page 24: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/24.jpg)
ContextContextResource
ContextContextResource
Context
Function
Event AWS Lambda Managed by AWS
Not managed by AWS
Result (Optional)
Function Invocation
Resources can be files, records
in a DB, etc.
Lambda API Call
Functions can Modify Resources
![Page 25: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/25.jpg)
Events (Context)
Events (Context)
Generated by AWS
Not generated by AWS
ContextContextResource
ContextContextResource
Context
Function
Event AWS Lambda Managed by AWS
Not managed by AWS
Result (Optional)
Function Invocation
Lambda API Call
Resources can Generate more Events
![Page 26: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/26.jpg)
Events (Context)
Events (Context)
Generated by AWS
Not generated by AWS
ContextContextResource
ContextContextResource
AWS Lambda Managed by AWS
Not managed by AWS
Direct Use of Resource
For example, a file is uploaded
or something is written in a database
AWS Lambda
Function 2
Function 3
Function 1
Events can Trigger more Functions
![Page 27: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/27.jpg)
Sample Event-Driven Serverless Media-Sharing Application
![Page 28: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/28.jpg)
Client Application
Event-driven Backend&
User
![Page 29: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/29.jpg)
Client Application
Get Content Index
Get Content
Upload Content with Metadata
Update Content Metadata
Get Content Metadata
AWS Lambda
& User
![Page 30: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/30.jpg)
Client Application
Get Content Index
Get Content
Upload Content with Metadata
Update Content Metadata
Get Content Metadata
Files (Multimedia)
Database
AWS Lambda
& User
Resources
![Page 31: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/31.jpg)
Client Application
Get Content Index
Get Content and Thumbnails
Upload Content with Metadata
Update Content Metadata
Get Content Metadata
Files (Multimedia)
Database
Build Thumbnails
Update Content Index
Extract and Update Metadata
Event: new or
updated file
Event: new or updated
content metadata
AWS Lambda
& User
Resources
![Page 32: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/32.jpg)
Client Application
Get Content Index
Get Content and Thumbnails
Upload Content with Metadata
Update Content Metadata
Get Content Metadata
Files (Multimedia)
Database
Build Thumbnails
Update Content Index
Extract and Update Metadata
Event: new or
updated file
Event: new or updated
content metadata
AWS Lambda
& User
Resources
Access to AWS services, such as AWS Lambda,
and the resources used by your application,
should be protected
![Page 33: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/33.jpg)
Get Content Index
Get Content and Thumbnails
Upload Content with Metadata
Update Content Metadata
Get Content Metadata
Files (Multimedia)
Database
Build Thumbnails
Update Content Index
Extract and Update Metadata
& User
# Mobile
App
![Page 34: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/34.jpg)
Get Content Index
Get Content and Thumbnails
Upload Content with Metadata
Update Content Metadata
Get Content Metadata
Files (Multimedia)
Database
Build Thumbnails
Update Content Index
Extract and Update Metadata
& User
" Web Browsers
(JavaScript)
![Page 35: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/35.jpg)
Calling Lambda Function from the Client
![Page 36: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/36.jpg)
Client Application
AWS Lambda Function
AWS Lambda Invoke API
& User
Calling Lambda Functions Directly
![Page 37: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/37.jpg)
Client Application
AWS Lambda Function
AWS Lambda Invoke API
Get Temporary AWS Credentials Amazon
Cognito
& User
Getting AWS Credentials from Amazon Cognito
![Page 38: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/38.jpg)
Client Application
AWS Lambda Function
Amazon Cognito
Amazon API Gateway
Get Temporary AWS Credentials
Web API Modeling, Caching, Throttling, Logging, CDN, etc.
& User
Exposing Functions as Web API
![Page 39: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/39.jpg)
Client Application
AWS Lambda Function
Amazon API Gateway
Web API Modeling, Caching, Throttling, Logging, CDN, etc.
& User
Exposing Functions as Public Web API
![Page 40: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/40.jpg)
https://some.domain/stage/resource1/resource2/…/resourceN
GETPOSTPUTDELETEHEADPATCHOPTIONS
Unique domain that you can customize
API stage, for example prod, test, dev, or v0, v1, …
Resources as part of the URL
HTTP verb used when
accessing the URL
function1function2function3function1function2
function3function1
Function to execute
Web API to Lambda Functions Integration
![Page 41: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/41.jpg)
Introducing Amazon Cognito Identity
![Page 42: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/42.jpg)
Client Application
Amazon Cognito
1. Using the Application
2. Send Identity Pool ID
3. Get Identity ID + AWS Temp Credentials
for the Unauthenticated Role
All AWS Services, including
APIs managed by Amazon
API Gateway
AWS Services4. Call AWS Services using
AWS Temp Credentials& User
Amazon Cognito for Unauthenticated Identities
![Page 43: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/43.jpg)
Client Application
Amazon Cognito
1. Using the Application
2. Send Identity Provider
Credentials
3. Get Authentication
Token4. Send
Identity Pool ID +Authentication Token
6. Get Identity ID + AWS Temp Credentials
for the Authenticated Role
All AWS Services, including
APIs managed by Amazon
API Gateway
AWS Services7. Call AWS Services using
AWS Temp Credentials
5. CheckAuthentication Tokenwith Identity Provider
Identity Provider
& User
Amazon Cognito for Authenticated Identities
![Page 44: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/44.jpg)
Client Application
Custom Authentication Amazon
Cognito
1. Using the Application
2. Send Identity Provider
Credentials
4. Send Authentication
Token to Client 5. Send
Identity Pool ID +Authentication Token
6. Get Identity ID + AWS Temp Credentials
for the Authenticated Role
All AWS Services, including
APIs managed by Amazon
API Gateway
AWS Services7. Call AWS Services using
AWS Temp Credentials
3. Get Authentication
Token from Cognito
& User
Amazon Cognito for Developer Authenticated Identities
![Page 45: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/45.jpg)
Best Practices
![Page 46: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/46.jpg)
!
Reactive Manifesto
![Page 47: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/47.jpg)
!
Reactive Manifesto
![Page 48: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/48.jpg)
Reactive Manifesto
DistributedAsynchronous
Eventual Consistency
!
![Page 49: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/49.jpg)
<demo>…
</demo>
![Page 50: Event-Driven Serverless Apps - Pop-up Loft Tel Aviv](https://reader031.fdocuments.in/reader031/viewer/2022030313/58a79c401a28ab03128b460f/html5/thumbnails/50.jpg)
Danilo PocciaTechnical Evangelist @danilop