+ All Categories
Home > Technology > Building Event-driven Serverless Applications

Building Event-driven Serverless Applications

Date post: 26-Jan-2017
Category:
Upload: amazon-web-services
View: 525 times
Download: 1 times
Share this document with a friend
42
Building Event-Driven Serverless Applications Danilo Poccia, Technical Evangelist @danilop
Transcript

Building Event-Driven Serverless Applications

Danilo Poccia, Technical Evangelist @danilop

You Want to BuildYour Brand New Application

Application+

Data

Application+

Data

Websites

Mobile Apps

Wearable

Application Data

Websites

Mobile Apps

Wearable

Application

Files

DB

Websites

Mobile Apps

Wearable

Application

Files

DB

Content +Some API Calls

API Calls

Websites

Mobile Apps

Wearable

Application

Files

DB

API Calls

Websites(JavaScript

Apps)

Mobile Apps

Wearable

JavaScript

API Calls

Application

Files

DB

API Calls

Websites(JavaScript

Apps)

Mobile Apps

Wearable

Services

API Calls

JavaScript

API Calls

Application

Files

DB

API Calls

Websites(JavaScript

Apps)

Mobile Apps

Wearable

Services

API Calls

JavaScriptAuthentication& Authorization

APIManagement,

Caching & Throttling

Business Logic

API Calls

Application

DB

API Calls

Websites(JavaScript

Apps)

Mobile Apps

Wearable

Services

API Calls

JavaScript

Files

AmazonS3

AmazonDynamoDB

API Calls

Authentication& Authorization

APIManagement,

Caching & Throttling

Business Logic

Application

DB

API Calls

Websites(JavaScript

Apps)

Mobile Apps

Wearable

Services

API Calls

JavaScript

Files

AmazonS3

AmazonDynamoDB

Authentication & Authorization

AmazonCognito

Business Logic

AWSLambda

API Management,Caching & Throttling

Amazon APIGatewayAPI Calls

How Does It Works?

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

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

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

Amazon CognitoUser Pools

Get Token

Token Authentication & Authorization

AmazonCognito

Amazon Cognito

User Pools

AmazonCloudFront

API Gateway Cache

AmazonCloudWatch

Monitoring & Logs

Endpoints onAmazon EC2 or

AWS Elastic Beanstalk

Internet

Any other publicly accessible endpoint

AWS Lambda Functions

API Management,Caching & Throttling

Amazon APIGateway

X

Access toAPI Method

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 Import / Export Support

Request / Response Data Transformation and API Mocking

Custom Authorization

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

?

?

?

?

???

AmazonCloudWatch

Events

Build Back-end Services that Perform at Scale

Respond Quickly to New Information

Run Your Code without Managing Infrastructure

Cost-effective and Efficient

Amazon API Gateway+

AWS Lambda

Resource + HTTP Verb ➔ Method (Function)

Resource + HTTP Verb ➔ Method (Function)

/books + GET ➔ GetAllBooksByRange

Resource + HTTP Verb ➔ Method (Function)

/books + GET ➔ GetAllBooksByRange

/books + POST ➔ CreateNewBook

Resource + HTTP Verb ➔ Method (Function)

/books + GET ➔ GetAllBooksByRange

/books + POST ➔ CreateNewBook

/books/{id} + GET ➔ GetBookById

/books/{id} + PUT ➔ CreateOrUpdateBookById

/books/{id} + DELETE ➔ DeleteBookById

<hands-on>...

</hands-on>

Let’s Put Everything Together

Media Sharing Application

λ

λ λ

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

λ

λ λ

λ

λ

λλ

λ

λ

λ

Microservice Architecture

λλ λλ

λλ λλ λ

λ

Choreography vs Orchestration

λλ λλ

λλ λλ λ

λ

Reactive Programming

λλ λλ

λλ λλ λ

λ

Asynchronous Communication

λλ λλ

λλ λλ λ

λ

Eventual Consistency

λλ λλ

λλ λλ λ

λ

The Serverless Manifesto

• Functions are the unit of deployment and scaling.• No machines, VMs, or containers visible in the programming model.• Permanent storage lives elsewhere.• Scales per request. Users cannot over- or under-provision capacity.• Never pay for idle (no cold servers/containers or their costs).• Implicitly fault tolerant because functions can run anywhere.• BYOC - Bring your own code.• Metrics and logging are a universal right.

Focus on Your Idea

aws.amazon.com/free

@danilop


Recommended