Deep Dive: AWS Lambda

36
AWS Pop-up Loft London Deep Dive: AWS Lambda Danilo Poccia @danilop danilop

Transcript of Deep Dive: AWS Lambda

Page 1: Deep Dive: AWS Lambda

AWS Pop-up Loft LondonDeep Dive: AWS Lambda

Danilo Poccia @danilop danilop

Page 2: Deep Dive: AWS Lambda

You Want to BuildYour Brand New Application

Page 3: Deep Dive: AWS Lambda

Application+

Data

Page 4: Deep Dive: AWS Lambda

Application+

Data

Websites

Mobile Apps

Wearable

Page 5: Deep Dive: AWS Lambda

Application Data

Websites

Mobile Apps

Wearable

Page 6: Deep Dive: AWS Lambda

Application

Files

DB

Content +Some API Calls

API Calls

Websites

Mobile Apps

Wearable

Page 7: Deep Dive: AWS Lambda

Application

Files

DB

API Calls

Websites(JavaScript

Apps)

Mobile Apps

Wearable

JavaScript

API Calls

Page 8: Deep Dive: AWS Lambda

Application

Files

DB

API Calls

Websites(JavaScript

Apps)

Mobile Apps

Wearable

Services

API Calls

JavaScript

API Calls

Page 9: Deep Dive: AWS Lambda

Application

Files

DB

API Calls

Websites(JavaScript

Apps)

Mobile Apps

Wearable

Services

API Calls

JavaScriptAuthentication& Authorization

Caching & Throttling

Business Logic

API Calls

Page 10: Deep Dive: AWS Lambda

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 11: Deep Dive: AWS Lambda

How Does It Works?

Page 12: Deep Dive: AWS Lambda

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 13: Deep Dive: AWS Lambda

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 14: Deep Dive: AWS Lambda

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 15: Deep Dive: AWS Lambda
Page 16: Deep Dive: AWS Lambda

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 17: Deep Dive: AWS Lambda

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

Page 18: Deep Dive: AWS Lambda

Build Back-end Services that Perform at Scale

Respond Quickly to New Information

Run Your Code without Managing Infrastructure

Cost-effective and Efficient

Page 19: Deep Dive: AWS Lambda

Amazon API Gateway+

AWS Lambda

Page 20: Deep Dive: AWS Lambda

Resource + HTTP Verb ➔ Method (Function)

Page 21: Deep Dive: AWS Lambda

Resource + HTTP Verb ➔ Method (Function)

/books + GET ➔ GetAllBooksByRange

Page 22: Deep Dive: AWS Lambda

Resource + HTTP Verb ➔ Method (Function)

/books + GET ➔ GetAllBooksByRange

/books + POST ➔ CreateNewBook

Page 23: Deep Dive: AWS Lambda

Resource + HTTP Verb ➔ Method (Function)

/books + GET ➔ GetAllBooksByRange

/books + POST ➔ CreateNewBook

/books/{id} + GET ➔ GetBookById

/books/{id} + PUT ➔ CreateOrUpdateBookById

/books/{id} + DELETE ➔ DeleteBookById

Page 24: Deep Dive: AWS Lambda

<demo>…

</demo>

Page 25: Deep Dive: AWS Lambda

Let’s Put Everything Together

Page 26: Deep Dive: AWS Lambda

Media Sharing Application

Page 27: Deep Dive: AWS Lambda

λ

λ λ

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 28: Deep Dive: AWS Lambda

λ

λ λ

λ

λ

λλ

λ

λ

λ

Page 29: Deep Dive: AWS Lambda

Microservice Architecture

λλ λλ

λλ λλ λ

λ

Page 30: Deep Dive: AWS Lambda

Choreography vs Orchestration

λλ λλ

λλ λλ λ

λ

Page 31: Deep Dive: AWS Lambda

Reactive Programming

λλ λλ

λλ λλ λ

λ

Page 32: Deep Dive: AWS Lambda

Asynchronous Communication

λλ λλ

λλ λλ λ

λ

Page 33: Deep Dive: AWS Lambda

Eventual Consistency

λλ λλ

λλ λλ λ

λ

Page 34: Deep Dive: AWS Lambda

Focus on You Idea

Page 35: Deep Dive: AWS Lambda

aws.amazon.com/free

Page 36: Deep Dive: AWS Lambda

Danilo Poccia @danilop danilop

Thank You