running a web site without servers - aws lambda + s3

16
25 February, 2016 Running a web site without servers - AWS Lambda + S3 Konstantin Halachev

Upload: awsbulgaria

Post on 14-Apr-2017

184 views

Category:

Software


0 download

TRANSCRIPT

25 February, 2016

Running a web site without servers -AWS Lambda + S3

Konstantin Halachev

What do we want?

AwebsitetofindbestticketstogotoChampionsLeaguegames

• Flexibledates

• Flexiblelocations

Findpricesforflightsbetweentheusercityandthegamecity

usingSkyscannerAPI

http://business.skyscanner.net

https://github.com/Skyscanner/skyscanner-python-sdk

How will we do it?

Demotime

Standard architecture

Replacing the frontend with S3 hosting

New architecture

How can we simplify this backend?

Backend using AWS Lambda

Lambda is about simple code in AWS: Write a function. Run it

• AWS Lambda is stateless, event-driven compute code called Lambda functions

• Triggered by events (object put in S3, message in message queue, write in Dynamo DB, call of rest endpoint)

• Cheap! Pay as you go

• Scalability and availability: no planning for servers, scaling or AWS-related hardware problems

Replacing the backend with AWS Lambda

Limitations

• Best for stateless calls• At most 1.5 GB of memory• Runs for at most 5 minutes• Continuous deployment is … in progress

What does a Lambda function look like?

Final architecture

Costs per 1000 sessions is 11 cents !!!

• S3hosting• S3Storage:$0.03/GB/Month• GETrequests:$0.004per10,000

requests• Datatransfer:$0.090perGB

• AWSLambda• every1,000,000requestscost

0.20$• 10,0001secondscallstothe

smallestconfigs 128MBcost0.02$

• APIGateway• $3.50permillionAPIcalls• Datatransfer$0.09/GB

• Per1000sessionsis~$0.11• S3hosting(5GET/session,0.5MB/session)

• 3MBtotal=0• 5filesperload=$0.02• 0.5MBperload=$0.05

• AWSLambda(5callspersession,<1s/call)• $0.001• 0.01$

• APIGateway(5callspersession,2kb/call)• $0.02• $0.005

TL;DR;

Championsleagueranforaweekwith>1000usersperdayfor

<1$

quartermile one15 lauriston placeedinburgh eh3 9en

tel: +44 (0)131 252 5353fax: +44 (0)131 252 5354

follow us @skyscannerjoin us on facebook.com/skyscanner

Thank [email protected]

@Kontinuit