72
Architecting for the @axelfontaine Cloud

Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Architecting for the

@axelfontaine

Cloud

Page 2: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse
Page 3: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

About Axel Fontaine

• Founder and CEO of Boxfuse

• Over 15 years industry experience

• Continuous Delivery expert

• Regular speaker at tech conferences

• JavaOne RockStar in 2014

@axelfontaine

Page 4: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

flywaydb.org

Page 5: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

boxfuse.com

Page 6: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

about

questions

Page 7: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

POLL:what type of infrastructure are you running on?

• On Premise

• Colocation

• Root Server

• Cloud

Page 8: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

what is special about the cloud ??

Page 9: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Every day, AWS adds enough server capacity to power the whole $7B enterprise Amazon.com was in 2004.Weekends included.

Page 10: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

"Advanced Test Reactor" by Argonne National Laboratory -originally posted to Flickr as Advanced Test Reactor core, Idaho National LaboratoryUploaded using F2ComButton. Licensed under CC BY-SA 2.0 via Wikimedia Commons -http://commons.wikimedia.org/wiki/File:Advanced_Test_Reactor.jpg#mediaviewer/File:Advanced_Test_Reactor.jpg

"RIAN archive 341194 Kursk Nuclear Power Plant" by RIA Novosti archive, image #341194 / Sergey Pyatakov / CC-BY-SA 3.0. Licensed under CC BY-SA 3.0 via Wikimedia Commons -http://commons.wikimedia.org/wiki/File:RIAN_archive_341194_Kursk_Nuclear_Power_Plant.jpg#mediaviewer/File:RIAN_archive_341194_Kursk_Nuclear_Power_Plant.jpg

Control Plane Data Plane

Page 11: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Control Plane Data Plane

Page 12: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Shift to a world of abundance(no more resource scarcity)

Clean Control Plane/Data Plane splitwith API-based provisioning

Cost-based Architectureswith the ability to turn infrastructure off

benefits of the cloud

Page 13: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

moving to the cloud

Page 14: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

lift & shift(= the naïve approach)

Page 15: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Congratulations! You now have:

• A more expense Hetzner/OVH

• Lots of (too much?) trustin your cloud provider

• Potential legal troubledue to data privacy laws

lift & shift(= the naïve approach)

Page 16: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

understanding the cloud

Page 17: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

regions

Page 18: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

availability zones

<<IMAGE GERMANY + two small clouds with racks>>

Page 19: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

building blocks

http://en.wikipedia.org/wiki/Lego#/media/File:Lego_Color_Bricks.jpg

Page 20: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

building blocks

Security

Storage NetworkCompute

Page 21: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse
Page 22: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

The hard Truth about Security

1. Always breakable with infinite time & resources

2. Must make it more complicated/expensive to break

than it’s worth (use defense in depth!)

3. Has a usability cost

4. Almost always about the data

Page 23: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

the 3 states of data

Data at Rest Data in MotionData in Use

Page 24: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Trusting your neighbors is good. But it’s even better to put a good lock on the door.

Werner VogelsCTO of an online book shop

http://en.wikipedia.org/wiki/Werner_Vogels#/media/File:Wernervogels_ddp.jpg

Page 25: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Data in Motion

TLS / SSL

Page 26: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Data in Use & at Rest

Client-side encryption

Page 27: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Client-side encryption

Encrypt sensitive & personally identifiable data

Use different Encryption key for each field/record

Encrypt Encryption Key using Key encrypting Key

Secure & Rotate the Key encrypting Key

Page 28: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Key Management

In App€

KMS€€

HSM€€€€€

Page 29: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Querying Encrypted Data

Otherclear text

field

Id Encrypted

123 #!azw\b

456 67ftf6&)

Exact Match=> Hmac

Hmac Encrypted

5841545832 #!azw\b

0219237127 67ftf6&)

Range=> Lower fidelity

Low Fi Encrypted

48.5 #!azw\b

37.2 67ftf6&)

=> Use transparent persistence layer converters!

Page 30: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Compute

Page 31: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

POLL:which level of automation are you at?

• Build• Unit Tests• Continuous Integration• Acceptance Tests• Continuous Deployment (Code)• Continuous Deployment (Code + DB + Configuration)• Infrastructure

Page 32: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Build Test

Page 33: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Build Test

Page 34: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

• One immutable unit• Regenerated after every change• Promoted from Environment to Environment

Classic Mistake: Build per Environment

Page 35: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Image Instance

Fully Baked Provisioned on Startup

?

Page 36: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Fully Baked Provisioned on Startup

Most people

Every Instance 100% identical

Fastest startup

Launch always succeeds

Page 37: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Fully Baked Provisioned on Startup

Most people

One immutable unit

Regenerated after every change

Promoted from environment to environment

Page 38: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Fully Baked

One immutable unit

Regenerated after every change

Promoted from environment to environment

Image

Page 39: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

One immutable unit

Regenerated after every change

Promoted from environment to environment

Page 40: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Fully Baked

One immutable unit

Regenerated after every change

Promoted from environment to environment

Image

Page 41: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Fully Baked

Image Instance

keep your instances stateless

Page 42: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

high uptime is a liability

The longer an instance is up,the harder it becomes to recreate exactly

(and it will fail eventually!)

Page 43: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Focus shift

Individual instances become disposable

Instance Service

Page 44: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Treat servers like cattle instead of pets

Page 45: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

What are the implications ???

Page 46: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

scaling

Image Instance

Page 47: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

types of scaling

up

down

in out

Page 48: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

scaling triggers for different types of services

sync=> load

async=> queue depth

cron=> time

Page 49: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

scaling & costs

vs

prefer smaller granularity

Page 50: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

instance types

GeneralPurpose

CPU

RAM

Disk

Page 51: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

How to solve service discovery ?

Use a stable entry point with an internal registry

Instance

Instance

Instance

? ElasticLoad

Balancer

Page 52: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

• Bake as much configuration as possible for all environments directly in the Image

• Use environment detection and auto-configuration

• Pass remaining configuration at startup and expose it as environment variables

Key Value

JDBC_URL jdbc:…

ENV prod

what about configuration ???

Page 53: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

what about the database ???

• Keep all persistent state out of the instance, including the database

• Use one of the many good hosted solutions available like Amazon RDS or Google Cloud SQL

• Use a database migration tool to update the schema on application startup

Instance

Page 54: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

what about the logs ???LOG file

LOG file

LOG file

ssh me@myserver1tail -f server.log

ssh me@myserver2tail -f server.log

ssh me@myserver3tail -f server.log

Page 55: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

LOG file

LOG file

LOG file log server

Page 56: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Ship logs to a central log server

where they can be• aggregated• stored and backuped• indexed• searched through a nice web UI

Many good hosted solutions• Loggly• Logentries• Papertrail• …

=> Think about data privacy!

Page 57: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

what about sessions ???

Keep session in an encrypted and signed cookie

• avoids session timeouts• avoids server clustering & session replication• avoids sticky sessions & server affinity

Page 58: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

what about rolling out new versions ???

Page 59: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Load Balancer

App v1

App v1

Logs

Availability Zone 1

Availability Zone 2

Page 60: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Load Balancer

App v1

App v1

Logs

Availability Zone 1

Availability Zone 2

Page 61: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Load Balancer

App v2

App v1

App v2

App v1

Logs

Availability Zone 1

Availability Zone 2

Page 62: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Load Balancer

App v2

App v1

App v2

App v1

Logs

Availability Zone 1

Availability Zone 2

Page 63: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

what about containers ???

Page 64: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

understanding modern CPUs

Both Intel and AMD have hardware support for virtualization

• isolation• performance

Page 65: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Image

Hardware

Hypervisor

Image

Hardware

OS+ContainerRuntime

ContainerVM

on prem

your responsibility

Page 66: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

cloud

your responsibility

cloud responsibilityinstance

schedulingmachineimages

instances instancevolumes

instancenetworking

containerscheduling

containerimages

containers containervolumes

containernetworking

Only makes sense if you cannot afford

8.75€/month granularity

Page 67: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

cloud

your responsibility

cloud responsibilityinstance

schedulingmachineimages

instances instancevolumes

instancenetworking

containerscheduling

containerimages

containers containervolumes

containernetworking

Only makes sense if you cannot afford

0.01€/hour granularity

Page 68: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

summary

Put a good lock on the door (use encryption!)

Use fully baked images (build once!)

Treat servers like cattle (disposable!)

Page 69: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

boxfuse.com

• Fully baked images generated in seconds(not minutes or hours)

• Optimized for JVM apps(Spring Boot, Dropwizard, Tomcat, TomEE, ...)

• Minimal images just 1% of size of regular OS(measured in MB not GB)

• Images work on VirtualBox & AWS(environment parity from dev to prod)

• Zero downtime updates on AWS(fully automatic blue/green deployments)

Page 70: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

final disclaimer

no animals were harmedwhile making this talk

Page 71: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse
Page 72: Architecting for the Cloud - GOTO Conferencegotocon.com/dl/...ArchitectingForTheCloud.pdf · Architecting for the @axelfontaine Cloud. About Axel Fontaine •Founder and CEO of Boxfuse

Thanks !

@axelfontaine

boxfuse.com