building event-driven serverless apps

36
Event-driven (Serverless) Applications Danilo Poccia AWS Technical Evangelist @danilop danilop

Upload: danilo-poccia

Post on 14-Apr-2017

1.267 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Building Event-driven Serverless Apps

Event-driven (Serverless) Applications

Danilo PocciaAWS Technical Evangelist

@danilopdanilop

Page 2: Building Event-driven Serverless Apps

2001

Page 3: Building Event-driven Serverless Apps

Decentralized, two-pizza teams

Agility, autonomy, accountability, and ownership

“DevOps”

Page 4: Building Event-driven Serverless Apps

You Want to BuildYour Brand New Application

Page 5: Building Event-driven Serverless Apps

Application+

Data

Page 6: Building Event-driven Serverless Apps

Application+

Data

Websites

Mobile Apps

Wearable

Page 7: Building Event-driven Serverless Apps

Application Data

Websites

Mobile Apps

Wearable

Page 8: Building Event-driven Serverless Apps

Application

Files

DB

Content +Some API Calls

API Calls

Websites

Mobile Apps

Wearable

Page 9: Building Event-driven Serverless Apps

Application

Files

DB

API Calls

Websites(JavaScript

Apps)

Mobile Apps

Wearable

JavaScript

API Calls

Page 10: Building Event-driven Serverless Apps

Application

Files

DB

API Calls

Websites(JavaScript

Apps)

Mobile Apps

Wearable

Services

API Calls

JavaScript

API Calls

Page 11: Building Event-driven Serverless Apps

Application

Files

DB

API Calls

Websites(JavaScript

Apps)

Mobile Apps

Wearable

Services

API Calls

JavaScriptAuthentication& Authorization

Caching & Throttling

Business Logic

API Calls

Page 12: Building Event-driven Serverless Apps

Application

DB

API Calls

Websites(JavaScript

Apps)

Mobile Apps

Wearable

Services

API Calls

JavaScript

Files

AmazonS3

AmazonDynamoDB

Authentication & Authorization

AmazonCognito

Business Logic

AWSLambda

Caching & Throttling

Amazon APIGatewayAPI Calls

Page 13: Building Event-driven Serverless Apps

How Does It Works?

Page 14: Building Event-driven Serverless Apps

X

AuthenticationProviders

End Users

User Credentials

AuthenticationToken

Amazon CognitoIdentity Broker

Identity Pool Id(Token)

Identity IdAWS Temp Credentials

(Depending onAuth / Unauth Role)

Access toAWS Services

(Including AmazonAPI Gateway)

Identity IdAWS Temp Credentials

Amazon S3

AmazonDynamoDB

AmazonMobile Analytics

Amazon CognitoSync Store

K / V

Authentication & Authorization

AmazonCognitoCheck Token

Page 15: Building Event-driven Serverless Apps

X

End Users

User Credentials

AuthenticationToken

Amazon CognitoIdentity Broker

Identity Pool Id(Token)

Identity IdAWS Temp Credentials

(Depending onAuth / Unauth Role)

Access toAWS Services

(Including AmazonAPI Gateway)

Identity IdAWS Temp Credentials

Amazon S3

AmazonDynamoDB

AmazonMobile Analytics

Amazon CognitoSync Store

K / V

Custom Authentication

ServiceGet Token

Token Authentication & Authorization

AmazonCognito

Page 16: Building Event-driven Serverless Apps

AmazonCloudFront

API Gateway Cache

AmazonCloudWatch

Monitoring & Logs

Endpoints onAmazon EC2 or

AWS Elastic Beanstalk

Internet

Any other publicly accessible endpoint

AWS Lambda Functions

Caching & Throttling

Amazon APIGateway

X

Access toAPI Method

Page 17: Building Event-driven Serverless Apps
Page 18: Building Event-driven Serverless Apps

Managed Cache to Store API Responses

Reduced Latency and DDoS Protection through Amazon CloudFront

SDK Generation for iOS, Android and JavaScript

HTTP 429 Response for API Throttling (Managed by the SDK)

Swagger Support

Request / Response Data Transformation and API Mocking

Page 19: Building Event-driven Serverless Apps

Business Logic

AWSLambda

AWSLambda

Functions

AmazonAPI Gateway Amazon S3

AmazonDynamoDB

Amazon CognitoSync Store

K / VAmazonSNS

AmazonKinesis

Alexa Skills Kit (ASK)Alexa Voice Service (AVS)

HTTPSInvoke

CustomEvents

HTTPSREST

API Call

AmazonSES

AmazonSWF

AWS IoT

?

?

?

?

???

Page 20: Building Event-driven Serverless Apps

Build Back-end Services that Perform at Scale

Respond Quickly to New Information

Run Your Code without Managing Infrastructure

Cost-effective and Efficient

Page 21: Building Event-driven Serverless Apps

Amazon API Gateway+

AWS Lambda

Page 22: Building Event-driven Serverless Apps

Resource + HTTP Verb ➔ Method

Page 23: Building Event-driven Serverless Apps

Resource + HTTP Verb ➔ Method

/books + GET ➔ GetAllBooks

Page 24: Building Event-driven Serverless Apps

Resource + HTTP Verb ➔ Method

/books + GET ➔ GetAllBooks

/books + POST ➔ CreateNewBook

Page 25: Building Event-driven Serverless Apps

Resource + HTTP Verb ➔ Method

/books + GET ➔ GetAllBooks

/books + POST ➔ CreateNewBook

/books/{id} + GET ➔ GetBookById

/books/{id} + PUT ➔ CreateOrUpdateBookById

/books/{id} + DELETE ➔ DeleteBookById

Page 26: Building Event-driven Serverless Apps

Let’s Put Everything Together

Page 27: Building Event-driven Serverless Apps

Media Sharing Application

Page 28: Building Event-driven Serverless Apps

λ

λ λ

AmazonAPI Gateway

λ

λ

λλ

Bucket Usage Table

Media MetadataTable

User StatTable

User Location

Table

K / V

λ

λ

λ

Amazon CognitoIdentity Broker

Amazon CognitoSync Store

AmazonSNS

AmazonKinesis

Media Bucket

LogTable

Authentication &

AuthorizationUpload Picture / VideoUpdate Bucket UsageCheck Bucket Usage

Delete “Over Quota”

Media

Send Notification to

User / Application

Extract Metadata and Write on DB

Update User StatisticsCall REST API

to Get Media Description

Upload Location Info

Update User Location

Look for Users or Media

Near Current Location

Call REST API to Get

User Info

Sync Media and User

Rating

Write History of ChangesCheck and Update

Ratings

InvokeRead

Write / Send

Page 29: Building Event-driven Serverless Apps

λ

λ λ

λ

λ

λλ

λ

λ

λ

Page 30: Building Event-driven Serverless Apps

Microservice Architecture

λλ λλ

λλ λλ λ

λ

Page 31: Building Event-driven Serverless Apps

Choreography vs Orchestration

λλ λλ

λλ λλ λ

λ

Page 32: Building Event-driven Serverless Apps

Reactive Programming

λλ λλ

λλ λλ λ

λ

Page 33: Building Event-driven Serverless Apps

<demo>…

</demo>

Page 34: Building Event-driven Serverless Apps

Focus on You Idea

Page 35: Building Event-driven Serverless Apps

aws.amazon.com/free

Page 36: Building Event-driven Serverless Apps

Event-driven (Serverless) Applications

Danilo PocciaAWS Technical Evangelist

@danilopdanilop