INSTITUCIONAL | Novos modelos de computação e Arquiteturas sem Servidores

38
SERVERLESS COMPUTING Glauber Gallego | Solutions Architect | AWS

Transcript of INSTITUCIONAL | Novos modelos de computação e Arquiteturas sem Servidores

SERVERLESS COMPUTINGGlauber Gallego | Solutions Architect | AWS

About me:Glauber Gallego – [email protected]

• Partner Solutions Architect;• Former TOTVS fellow;• Dev by heart; Ops by passion;• Job: Help partners and its customers go cloud;• Goal: Build a healthy and strong cloud ecosystem;

Let’s Build an App ...

Your Code Your App

compiling…

... And Deploy it to an AppServer ...

HTTP Server

Application Server

Language Interpreter

Operating System

Host

Your App

... And Connect it to a Database ...

Your Appin an

AppServer

Your Database

... And Release it to Your Customers ...

Your Appin an

AppServer

Your Databasehttp://your-app.com

On AWS: $87.05 https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-DADBA757-F4D3-499A-848A-8D42791CD4E8

... You Need a Backup ... Let’s Store it …

Your Appin an

AppServer

Your Databasehttp://your-app.com

On AWS: $87.05 (100% RDS provisioned storage is free) https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-DADBA757-F4D3-499A-848A-8D42791CD4E8

Your Backup

... Your App is a Little Success ... Let’s Scale it ...

Your Appin an

AppServer

Your Databasehttp://your-app.com Your Load

Balancer

On AWS: $119.82 https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-482FD4A6-1506-4E7A-9E13-BC5FB5D3895D

Your Backup

... Your App Appeared in a Blog ... Let’s Scale it …

Your Appin an

AppServer

Your Databasehttp://your-app.com Your Load

BalancerYour Static Files

On AWS: $134.40https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-53560CB9-FA91-42D0-9585-64CCEDF64EA5

Your Backup

... a Newspaper Linked to You ... Let’s Scale it …

Your Appin an

AppServer

Your Database

http://your-app.com Your Load Balancer

Your Static Files

Your Load Balancer

On AWS: $181.74https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-91B294EB-5E87-426C-A58C-3FA6FF39B904

... Your Stack was Attacked ... Let’s Protect it …

Your Appin an

AppServer

Your Database

http://your-app.com Your Load Balancer

Your Static Files

Your Load Balancer

DMZ Web TIer AppServer Tier DB Tier

On AWS: $181.74 (firewall is not charged)https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-91B294EB-5E87-426C-A58C-3FA6FF39B904

... Your Database is Suffering ... Let’s Scale it …

Your Appin an

AppServer

Your Write DB

http://your-app.com Your Load Balancer

Your Static Files

Your Load Balancer

Your Read DB

On AWS: $253.38https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-62524B1D-3966-4B2D-833C-65721FD9DACF

DMZ Web TIer AppServer Tier DB Tier

... Your App is Viral ... Let’s ”try” Scale it …

Your App in an AppServer

Your Write DB

http://your-app.com Your Load Balancer

Your StaticFiles

Your Load Balancer

Your Read DB

On AWS: $1615.37https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-B0E88A08-FD6A-4A55-9649-6511BAB0557B

DMZ Web TIer AppServer TierDB Tier

... Your App is Viral ... Let’s ”try” Scale it …

Your Write DB

http://your-app.com Your Load Balancer

Your StaticFiles

Your Load Balancer

Your Read DB

On AWS: $1615.37https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-B0E88A08-FD6A-4A55-9649-6511BAB0557B

Your App in an AppServer

DMZ Web TIer AppServer TierDB Tier

• Scales in minutes• Still tricky for breaking news, viral content, or attacks.

... Your App is Viral ... Let’s ”try” Scale it …

Your Write DB

http://your-app.com Your Load Balancer

Your StaticFiles

Your Load Balancer

Your Read DB

On AWS: $1615.37https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-B0E88A08-FD6A-4A55-9649-6511BAB0557B

Your App in an AppServer

DMZ Web TIer AppServer TierDB Tier

• Scales in minutes• Still tricky for breaking news, viral content, or attacks.

• Reduced operational complexity• But requires Ops with experience

... Your App is Viral ... Let’s ”try” Scale it …

Your Write DB

http://your-app.com Your Load Balancer

Your StaticFiles

Your Load Balancer

Your Read DB

On AWS: $1615.37https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-B0E88A08-FD6A-4A55-9649-6511BAB0557B

Your App in an AppServer

DMZ Web TIer AppServer TierDB Tier

• Scales in minutes• Still tricky for breaking news, viral content, or attacks.

• Reduced operational complexity• But requires Ops with experience

• Flexible choice of technology• Need Devs with rich skill set

... Your App is Viral ... Let’s ”try” Scale it …

Your Write DB

http://your-app.com Your Load Balancer

Your StaticFiles

Your Load Balancer

Your Read DB

On AWS: $1615.37https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-B0E88A08-FD6A-4A55-9649-6511BAB0557B

Your App in an AppServer

DMZ Web TIer AppServer TierDB Tier

• Scales in minutes• Still tricky for breaking news, viral content, or attacks.

• Reduced operational complexity• But requires Ops with experience

• Flexible choice of technology• Need Devs with rich skill set

• Cost-effective• Even on AWS, feels over-provisioned and over-payed

And How Much Does it Cost? In Terms of Users...

Your mythical, really simple and unreal webapp:- For 0 users/month => On AWS: $87.05

And How Much Does it Cost? In Terms of Users...

Your mythical, really simple and unreal webapp:- For 0 users/month => On AWS: $87.05 - For 100 users/month => On AWS: $87.05

And How Much Does it Cost? In Terms of Users...

Your mythical, really simple and unreal webapp:- For 0 users/month => On AWS: $87.05 - For 100 users/month => On AWS: $87.05- For 1.000 users/month => On AWS: $119.82

And How Much Does it Cost? In Terms of Users...

Your mythical, really simple and unreal webapp:- For 0 users/month => On AWS: $87.05 - For 100 users/month => On AWS: $87.05- For 1.000 users/month => On AWS: $119.82- For 10.000 users/month => On AWS: $134.40

And How Much Does it Cost? In Terms of Users...

Your mythical, really simple and unreal webapp:- For 0 users/month => On AWS: $87.05 - For 100 users/month => On AWS: $87.05- For 1.000 users/month => On AWS: $119.82- For 10.000 users/month => On AWS: $134.40- For 50.000 users/month => On AWS: $181.74

And How Much Does it Cost? In Terms of Users...

Your mythical, really simple and unreal webapp:- For 0 users/month => On AWS: $87.05 - For 100 users/month => On AWS: $87.05- For 1.000 users/month => On AWS: $119.82- For 10.000 users/month => On AWS: $134.40- For 50.000 users/month => On AWS: $181.74- For 100.000 users/month => On AWS: $253.38

And How Much Does it Cost? In Terms of Users...

Your mythical, really simple and unreal webapp:- For 0 users/month => On AWS: $87.05 - For 100 users/month => On AWS: $87.05- For 1.000 users/month => On AWS: $119.82- For 10.000 users/month => On AWS: $134.40- For 50.000 users/month => On AWS: $181.74- For 100.000 users/month => On AWS: $253.38- For 1.000.000 users/month => On AWS: $1615.37

Costs Not included ...

- Operations staff- How many Ops to handle ~ 80 instances?- And about release management?

Costs Not included ...

- Operations staff- How many Ops to handle ~ 80 instances?- And about release management?

- If not on AWS- Physical space - Racks- Cabling - Servers- Power - Storage- Colling - Staff- Networking

... Let’s rethink the app …

Your Write DB

http://your-app.com Your Load Balancer

Your StaticFiles

Your Load Balancer

Your Read DB

On AWS: $1615.37https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-B0E88A08-FD6A-4A55-9649-6511BAB0557B

Your App in an AppServer

DMZ Web TIer AppServer TierDB Tier

... Let’s rethink the app … S3 for static files.

http://your-app.com

On AWS: $1487.28https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-C30F3AEB-D484-488B-9584-F278B6280301

S3

Route 53 CloudFront Your Load Balancer

Your Write DB

Your Read DB

Your App in an AppServer

Web TIer AppServer TierDB Tier

... Let’s rethink the app … DynamoDB for DB

http://your-app.com

On AWS: $1465.91https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-9E1F073F-8AC1-4AAC-B981-BB3E9AE5C7AE

S3

Route 53 CloudFront Your Load Balancer

Your App in an AppServer

Web TIer AppServer TierDB Tier

DynamoDB

... Let’s rethink the app … Lambda for Compute

http://your-app.com

On AWS: $587.89 + $ 110.42 (lambda: 500MM req / 10ms) + $50 (api gateway) + $0 (cognito): $ 748.31https://calculator.s3.amazonaws.com/index.html#r=IAD&key=calc-C6289E2C-4D18-41BC-A096-DDCE2E06A1CF

S3

Route 53 CloudFront

Web TIer App TierDB Tier

DynamoDB

CognitoIdentity

API Gateway

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Web Tier

http://your-app.com

S3

Route 53 CloudFront

Web TIer

• Static Assets• Same as in reference architecture• css, js, docs, images, videos + html

• Dynamic Functionality• Use JS framework (e.g. Angular)• SEO-friendly (Custom Error

Response + HTML5 History API)

• Completely Serverless• Pre-scaled• Low-cost• Low-maintenance

App Tier

App Tier

CognitoIdentity

API Gateway

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

Lambda Function

• Accelerated Backend• Write node.js, Python or Java

functions and load into Lambda• Power up Lambda with RESTful

endpoints on API Gateway• Cache, throttle, meter, version, etc.

• Completely Serverless• Pre-scaled• Low-cost• Low-maintenance

Database Tier

DB Tier

DynamoDB

• DynamoDB• Schema-free• Scale only reads and writes

• Completely Serverless• Pre-scaled• Low-cost• Low-maintenance

Demo: Using AWS Lambda with Amazon S3

http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html

https://secure.flickr.com/photos/dullhunk/202872717/