34
MOBILE APP FOR ACME INC. by Sean Hull - Cloud Solutions Architect - [email protected]

techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

MOBILE APP FOR ACME INC.by Sean Hull - Cloud Solutions Architect - [email protected]

Page 2: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

ABOUT SEAN HULL

+1-917-442-3939

[email protected]

iheavy.com/blog

about.me/hullsean

github.com/hullsean

Page 3: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

NEWSLETTER - SIGNUP!

iheavy.com/signup

cloud topics

startup focused

innovation inspired!

Page 4: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

WHAT DO I DO?

Boutique Professional Services

Advisor, Fractional CTO

10+ years with startups

Devops + Data automation

AWS & GCP Clouds

Terraform + Ansible

Serverless Lambda, Python

MySQL, Postgres, Redshift

Page 5: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

–Steve Jobs

“If you play it safe, no onewill ever know who you are.”

Page 6: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

SHORT HISTORY OF HOSTING

90’s - on-premise server closet

00’s - managed hosting

10’s - cloud hosting, aws, gcp

Docker containers

Serverless functions

Page 7: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

ON-PREMISE HOSTING

full control

need team of hardware experts

need equipment, backups

Page 8: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

DATACENTER HOSTING

Professionally managed

Frees you to run your business

Still need operations team

Still slow to provision

Page 9: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

CLOUD HOSTING

On-demand compute

Pay for what you use

Stop & save unused servers

Cost by the hour

Need operations team

Page 10: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

DOCKER CONTAINERS

Supports microservices

Dockerfile defines server config

Need operations team

Page 11: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

SERVERLESS - FUNCTIONS

Worry only about your code

Deploy directly to the cloud

Event-based

No operations team

Page 12: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

20TH CENTURY POWER

Nicholas Carr, Edison, Google

Henry Burden -1850 to 1900

Before distributed power grid

Backoffice: waterwheel engineers

Replacement waterwheel parts!

Parallel today’s cloud computing

Page 13: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

PRODUCT REQUIREMENTS

Upload images from Web

Image editing w text memes

Track popular phrases

Track top-10 by views

Monthly archiving

Scales easily + low cost

Page 14: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

–Dwight D. Eisenhower

“Plans are nothing;planning is everything”

Page 15: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

TRADITIONAL ARCHITECTURE

Many moving parts

Full control over servers

Customer managed

Customer patched

Customer monitored

Page 16: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

CUSTOMER MANAGED SERVERS

Spinup instance

Install OS

Install packages

Manage dependencies

Manage updates

Monitor

Manage performance

Page 17: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

–Adrian Cockroft, VP Cloud Architecture Strategy

“Remember that meltdown patch, and the need to patch all the hosts and containers, but nothing to patch

for Lambda?”

Page 18: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

SERVERLESS ARCHITECTURE

1. User opens app

2. Request hits endpoint

3. User Login - cognito, auth0, okta, onelogin

4. Functions - upload, edit, albums, popular

5. Store user, image, text data

6. Store raw, edited & historical images

7. CDN - cache photos at edge

8. Separate AWS account for Meme app

9. CNAME entry acme.io -> endpoint

Page 19: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

#2 API ENDPOINT

Paths to your functions

GET method

Post method

Put method

Patch, Delete

Page 20: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

#3 USER LOGIN

Security assertion markup SAML

Auth0

Cognito

OneLogin

Active Directory Federated Svc

Page 21: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

#4 SERVERLESS LAMBDA

Code in Python, nodejs, java, C#

Respond to events

S3, SNS, CF, API Gateway

IOT, Alexa, SES, SW, Kinesis

Log messages to CloudWatch

Use aliases & versions

Page 22: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

#4 LAMBDA: HANDLER.JS

Code in Python, nodejs, java, C#

Respond to events

Log messages to CloudWatch

Use aliases & versions

Page 23: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

#4 LAMBDA: BESTENDPOINT.JS

Modularize your business logic

Build unit tests for product code

Easier for testing locally

Supports code reuse

Page 24: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

#4 LAMBDA: SERVERLESS.YML

Manifest defines your application

Outlines API gateway

Specifies functions

S3 buckets, Dynamodb tables

IAM users, etc

Page 25: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

#4 SERVERLESS LIMITATIONS

Account wide API limits

Memory limits

Max 5 minutes runtime

More difficult to troubleshoot

How to test performance?

AWS X-Ray instrumentation

Page 26: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

#5 DATASTORE - DYNAMODB

Configure table-by-table

store users & login info

store image names & paths

store text & meme data

Page 27: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

#6 S3 STORAGE FOR IMAGES

object storage

original raw images

edited images

thumbnails

historical copies

lifecycle versions

Page 28: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

#7 CLOUDFRONT CDN

Cache images at edge

Speedup user experience

Distribute globally

Integrates with app origin

Integrates with S3 origin

Page 29: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

#9 ROUTE53 FOR DNS

Domain name services

Named after port 53

Add CNAME for your domain

References API Endpoint

Page 30: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

THOUGHTS ON APP

What type of browsers are supported?

What type of formats need support?

Do we need multi-language support?

How do you measure active users?

Page 31: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

THOUGHTS ON INFRA

Are your users global or in one region?

What uptime guarantees are required?

Can we lose images (user re-uploads)?

Ex: Instagram & Twitter lose comments sometimes

Page 32: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

THOUGHTS ON TEAM

Will Acme Inc. support finished app?

Does Acme Inc. have devops expertise?

How about lambda & serverless?

Does Acme Inc know technology X?

Do you need to support multi-cloud?

Page 33: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

ABOUT SEAN HULL

+1-917-442-3939

[email protected]

iheavy.com/blog

about.me/hullsean

github.com/hullsean

Page 34: techhub mobile app - iheavy.com · SERVERLESS ARCHITECTURE 1. User opens app 2. Request hits endpoint 3. User Login - cognito, auth0, okta, onelogin 4. Functions - upload, edit, albums,

NEWSLETTER - SIGNUP!

iheavy.com/signup

cloud topics

startup focused

innovation inspired!