aws lambda in the browseraws lambda auto scaling (never under or over provision) focus on business...

19
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Olivier Klein Solutions Architect, AWS 17 th May 2015 Modern Web Conference Taipei AWS Lambda in the Browser Javascript Interface and Node.js App Without a Single Server

Upload: others

Post on 11-Jun-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Olivier Klein

Solutions Architect, AWS

17th May 2015

Modern Web Conference Taipei

AWS Lambda in the Browser Javascript Interface and Node.js App Without a Single Server

Page 2: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

What do we expect from modern web applications?

Page 3: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

Modern Web Applications Expectations

• What do we expect from web applications?

• Highly Availability

• Scalability

• Predictable Responsiveness

• Fault Tolerance

• How can we achieve this?

• Multiple datacenter facilities

• Auto-Scalable databases

• Auto-Scalable server infrastructure

• Load-Balancing

• etc.

Page 4: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero
Page 5: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

Oregon Beijing

Tokyo

Singapore

Ireland

GovCloud

Northern California Sydney

São Paulo

11 Regions

29 Availability Zones

53 Edge Locations

Continuous Expansion

Frankfurt

N. Virginia

AWS Global Infrastructure

Page 6: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

Web Services

Core Services Compute Storage Database Networking

Infrastructure Regions Availability Zones Edge Locations

Platform Services

Analytics App Deployment Mobile

Virtual Desktops

Collaboration & Sharing

App Delivery E-Mail

Access Control

Auditing Monitoring Encryption Security

Applications

API

&

SDKs

Page 7: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

So what’s this AWS Lambda?

Page 8: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

AWS Lambda

Auto Scaling

(Never under or over

provision)

Focus on business logic,

not infrastructure. Upload

your code; AWS Lambda

handles everything else

Zero Administration

Lambda scales the

infrastructure as needed

to match the event rate

and pay as you go

Bring Your Own Code

“Run your code in the cloud in response to events and scale without any

servers to manage”

Write your code in JavaScript

just like with a Node.js app

Page 9: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

Event-Driven Compute

• Stateless, request-driven code called

Lambda functions

• Invoke Lambda functions straight from

JavaScript or even your Mobile app

• Triggered functions by events (state

transitions) in other services:

• New object in your object store

• New item in your NoSQL database

• New message in your notification service

Amazon Lambda

Page 10: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

AWS JavaScript SDK

<script src="js/aws-sdk-2.1.26.min.js"></script>

// Construct a service object

var lambda = new AWS.Lambda();

// Making requests

lambda.invoke({FunctionName: ’myfunc’}, function(err, data) {

if (err) console.log(err, err.stack);

else {

var result = JSON.parse(data.Payload);

// Process result

}

});

JavaScript SDK

Page 11: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

Great, but you said no servers?

Page 12: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

How to get the JavaScript to the browser?

?

Page 13: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

Amazon S3 & Amazon CloudFront

• Amazon S3

• Highly available object storage

• Designed for 99.999999999% durability

• Offers HTTP / HTTPS endpoint to objects

• Amazon CloudFront

• Content Delivery Network with 53 edge

locations across the world

• Caches content on edge location for low

latency

Amazon S3

Amazon CloudFront

Page 14: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

Amazon S3 Amazon

CloudFront Browser

Page 15: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

But Lambda is stateless, where to store data?

Page 16: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

Amazon DynamoDB

Non-Relational Managed NoSQL Database Service

• Schemaless Data Model

• Consistent low latency performance

• Predictable provisioned throughput

• Seamless Scalability

• No storage limits

• High durability and availability

• Replicated across 3 Facilities

• Fully Managed and Low Cost

DynamoDB table

items

attributes

Page 17: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

Amazon Lambda

JavaScript SDK

Browser

Amazon DynamoDB

Amazon SNS

Facebook

Users

• Highly Available

• Scalable

• Fully Managed

• Fault Tolerant

Example Architecture

Amazon S3

Amazon CloudFront

Page 18: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

Demo Time!

Page 19: AWS Lambda in the BrowserAWS Lambda Auto Scaling (Never under or over provision) Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Zero

Thank you!

Olivier Klein

[email protected]