47
Startups Without Servers Dean Bryen - Solutions Architect - AWS Shaun Pearce - VP of Engineering - Gousto

Startups without Servers

Embed Size (px)

Citation preview

Page 1: Startups without Servers

Startups Without ServersDean Bryen - Solutions Architect - AWS

Shaun Pearce - VP of Engineering - Gousto

Page 2: Startups without Servers

Priorities for Startups

Page 3: Startups without Servers

3

Racing within a window of time

Page 4: Startups without Servers

4

Focus is on solving a problem

Page 5: Startups without Servers

5

Skills are in Development not Infrastructure

Page 6: Startups without Servers

6

Over-Engineering vs Re-Engineering

Page 7: Startups without Servers

7

Biggest fear is being a victim of your own success

Page 8: Startups without Servers

The Evolution of Architecture

Page 9: Startups without Servers

9

The Monolith

Page 10: Startups without Servers

10

Micro Services

Page 11: Startups without Servers

11

API Driven Development

Page 12: Startups without Servers

The Evolution of Compute and Storage

Page 13: Startups without Servers

13

Physical Servers / Disks / VM’s

Page 14: Startups without Servers

14

Containers

Page 15: Startups without Servers

15

Platform Level Services

Page 16: Startups without Servers

Dean’s AWS London Loft Challenge

Page 17: Startups without Servers

Build an image processing microservice that…..

Scales per request

Requires no deployment effort

Fault Tolerant

Has a RESTful API interface with a Web client

Page 18: Startups without Servers

The Catch

NO Servers

NO Monolithic App or Explicit Web Service

NO Explicit code for scaling and fault tolerance

And do it within 45 minutes…

Page 19: Startups without Servers

What Services Could we use?

Page 20: Startups without Servers

Static Assets in Amazon S3

Internet scale HTTP/S based object store

Inerently Highly Available and Fault Tolerant

Designed for 11 9’s of Durability

Can host static websites

Holds trillions of objects

Page 21: Startups without Servers

Serverless micro services with AWS Lambda

Event Driven Computing service

Never pay for idle

Scales per request

Supports Node.js and Java (or other JVM based languages)

Event triggers from other AWS Services

23 different ‘Power Levels’ of AWS Lambda

Page 22: Startups without Servers

A RESTful API with Amazon API Gateway

Host multiple versions and stages of your API

Create and distribute API Keys to your developers

Throttle and Monitor API Calls

Cache Responses

Transform Data

Generate SDK’s (Including Swagger Support)

Interact directly with AWS Lambda

Page 23: Startups without Servers

A NoSQL Data Store with Amazon DynamoDB

Managed noSQL Data Store

Can be either a Document or Key/Value store

Simply provision read and write throughput

Enables you to focuss on your data

DynamoDB streams enables you to take actions on events

Inherently Highly Available and Fault Tolerant

Page 24: Startups without Servers

Putting it all together

Page 25: Startups without Servers

The Service Itself

Static Site in S3

Web Client API Gateway Lambda Function + ImageMagic

Page 26: Startups without Servers

Auto Deployment

Uploads new version to S3Developer AWS Lambda

Deployment functionUpdateFunction API Call

to AWS Lambda

Page 27: Startups without Servers

Unit and Load Testing

HTTPS Invoke Function Image ProcessingFunction

Unit Test Function

Result Stored in DynamoDB

BONUS

Page 28: Startups without Servers

BONUS

Page 29: Startups without Servers

Let’s Get Building

Page 30: Startups without Servers

First, the MicroService itself

Page 31: Startups without Servers

Create the Image Processing Lambda Function

Static Site in S3

Web Client API Gateway Lambda Function + ImageMagic

Page 32: Startups without Servers

Build the API

Static Site in S3

Web Client API Gateway Lambda Function + ImageMagic

Page 33: Startups without Servers

Static site in S3

Static Site in S3

Web Client API Gateway Lambda Function + ImageMagic

Page 34: Startups without Servers

Test out the Web Client

Static Site in S3

Web Client API Gateway Lambda Function + ImageMagic

Page 35: Startups without Servers

Next, Set up Auto Deployment

Page 36: Startups without Servers

Create the Deployment Function

Uploads new version to S3Developer AWS Lambda

Deployment functionUpdateFunction API Call

to AWS Lambda

Page 37: Startups without Servers

Upload a new version to S3 to test

Uploads new version to S3Developer AWS Lambda

Deployment functionUpdateFunction API Call

to AWS Lambda

Page 38: Startups without Servers

Summary and Next Steps

Page 39: Startups without Servers

Summary

Utilise Platform Level Services that have built in HA

Use a microservices approach

Use a common interface for services such as RESTful APIs

Store static files in Amazon S3

Use AWS Lambda as the glue between AWS services

Page 40: Startups without Servers

Next Steps

Sign up for an AWS Account

Try out a new server-less ervice

Make use of AWS Forums and Support

Come and meet an architect at the loft

Check out aws.amazon.com for more information

Page 41: Startups without Servers

Lambda @ GoustoShaun Pearce

VP Engineering

Page 42: Startups without Servers

About Gousto• We are an online recipe box service

offering customers the ability to choose up to 4 recipes for 2 or 4 people every week• We deliver all the ingredients you need

in exact proportions with step-by-step recipe cards.• No planning, no supermarkets and no

food waste – you just cook.• We’re a rapidly growing business, with a

diverse set of technology requirements.• Gousto’s tech team are responsible for

all consumer facing assets (Web, Mobile App) as well as backend ordering platforms and integrations into ERP, Warehouse Automation, Couriers etc

Page 43: Startups without Servers

Gousto’s Platform (early 2015)

Web Site (PHP Laravel)

Business Logic(PHP Laravel)

Users

CMS Users

Data Scientists Reporting Read Replica

Production Database

Key Challenges• Large monolithic app covering a broad

set of responsibilities (e-commerce, payment processing, courier integration etc.)• Becoming more complex and difficult to

maintain over time (hard to upgrade)• Increased risk of change starting to slow

progress• A growing development team working on

a single code base – diminishing returns on tech investment• Concerns a single database will become

a performance bottleneck

REST

Page 44: Startups without Servers

Roadmap to a Microservices Architecture

Web Site

API Gateway

Users

Recommendation API

(Lambda)Menu

Service (EC2)CustomerService . . .

RecommendationData

MenuData

CustomerData

. . .Data

CMS

CMS Users

Key Enhancements• Each area of concern is broken into a

separate, independent service• We use CloudFormation & Ansible to

heavily automate and standardise our microservice deployments• Where data can be easily extracted from

the existing schema a Lambda / DynamoDB implementation will be preferred• Where data remains relational these

services are being written in Node.js or PHP and deployed onto EC2

REST

Page 45: Startups without Servers

Asynchronous Notifications Pattern

Customer Service

Amazon SNS Topic

Payment Service

Delivery Schedule Service

. . .

• Increase performance for customers• Reduce synchronous dependencies between services• Lower the impact of failure of any one service

I’ve changed address

Got it, thanks.<address change>

Subscribe to addr changes

Subscribe to addr changes

Subscribe to addr changes

Amazon SQS Queues

1

3

2

4

5

n

Page 46: Startups without Servers

Thank You also… we’re recruiting [email protected]

Page 47: Startups without Servers

Thank YouDean Bryen - Solutions Architect - AWS

Shaun Pearce - VP of Engineering - Gousto