Clouds in Government Perils of Portability QCon 6th February 2013 - - PowerPoint PPT Presentation

clouds in government perils of portability
SMART_READER_LITE
LIVE PREVIEW

Clouds in Government Perils of Portability QCon 6th February 2013 - - PowerPoint PPT Presentation

Clouds in Government Perils of Portability QCon 6th February 2013 gareth rushgrove | morethanseven.net http://www.flickr.com/photos/wallyg/299908721/ Me Gareth Rushgrove @garethr gareth rushgrove | morethanseven.net Curate devopsweekly.com


slide-1
SLIDE 1 http://www.flickr.com/photos/wallyg/299908721/

Clouds in Government Perils of Portability

QCon 6th February 2013

gareth rushgrove | morethanseven.net
slide-2
SLIDE 2

Me

slide-3
SLIDE 3

Gareth Rushgrove @garethr

gareth rushgrove | morethanseven.net
slide-4
SLIDE 4

Curate devopsweekly.com

gareth rushgrove | morethanseven.net
slide-5
SLIDE 5

Blog at morethanseven.net

gareth rushgrove | morethanseven.net
slide-6
SLIDE 6

Work at UK Government Digital Service

Text

gareth rushgrove | morethanseven.net
slide-7
SLIDE 7 http://www.flickr.com/photos/benterrett/6852348725/

I am a Civil Servant

gareth rushgrove | morethanseven.net
slide-8
SLIDE 8 http://www.flickr.com/photos/iancarroll/5027441664

Perils

Clouds and portability

slide-9
SLIDE 9

The 2nd definition

gareth rushgrove | morethanseven.net

per·il

/ˈperəl/ Noun

  • 1. Serious and immediate danger.
  • 2. The dangers or difficulties that arise

from a particular situation or activity.

slide-10
SLIDE 10

Peril 1

Caring about Image formats

http://www.flickr.com/photos/uk_parliament/2700327415
slide-11
SLIDE 11

AMI, VMDK, OVF , VHD, VDI, etc.

gareth rushgrove | morethanseven.net
slide-12
SLIDE 12 http://www.flickr.com/photos/uk_parliament/2700311119/

But I have many machines

gareth rushgrove | morethanseven.net
slide-13
SLIDE 13 http://www.flickr.com/photos/uk_parliament/2700327415

And my infrastructure is more than just machines

gareth rushgrove | morethanseven.net
slide-14
SLIDE 14

Peril 2

API proliferation

http://www.flickr.com/photos/uk_parliament/2700327415
slide-15
SLIDE 15

Amazon EC2

gareth rushgrove | morethanseven.net
slide-16
SLIDE 16

Big API (Just EC2)

gareth rushgrove | morethanseven.net

160+ actions

slide-17
SLIDE 17

Lots more APIs

gareth rushgrove | morethanseven.net
slide-18
SLIDE 18

API compatibility and de facto standards

gareth rushgrove | morethanseven.net http://www.flickr.com/photos/uk_parliament/2700357007/
slide-19
SLIDE 19

Greenqcloud is EC2 compatible

gareth rushgrove | morethanseven.net

greenqloud.com

slide-20
SLIDE 20

Eucalyptus

gareth rushgrove | morethanseven.net

www.eucalyptus.com

slide-21
SLIDE 21 gareth rushgrove | morethanseven.net

EUCALYPtUS

Funny story

slide-22
SLIDE 22

Eucalyptus is an acronym

gareth rushgrove | morethanseven.net

Elastic Utility Computing Architecture for Linking Your Programs to Useful Systems

slide-23
SLIDE 23

Ta da

gareth rushgrove | morethanseven.net

Elastic Utility Computing Architecture for Linking Your Programs to Useful Systems

slide-24
SLIDE 24

It’s not all about the APIs

gareth rushgrove | morethanseven.net http://www.flickr.com/photos/uk_parliament/2757120644
slide-25
SLIDE 25

Peril 3

Cloud primitives

http://www.flickr.com/photos/uk_parliament/2700327415
slide-26
SLIDE 26

AWS - All the acronyms!

gareth rushgrove | morethanseven.net
  • Instance
  • Images
  • Elastic Compute Cloud (EC2)
  • Elastic IP (EIP)
  • Elastic Network Interfaces (EIN)
  • Elastic Block Store (EBS)
  • Simple Storage Service (S3)
  • Elastic Load Balancers (ELB)
slide-27
SLIDE 27

OpenStack

gareth rushgrove | morethanseven.net

www.openstack.org

slide-28
SLIDE 28

OpenStack

gareth rushgrove | morethanseven.net
  • Compute
  • Storage
  • Networking
  • Instance
  • Security group
  • Object store
  • Block store
slide-29
SLIDE 29

CloudStack

gareth rushgrove | morethanseven.net

incubator.apache.org/cloudstack/

slide-30
SLIDE 30

CloudStack

gareth rushgrove | morethanseven.net
  • Network
  • VPC
  • Virtual machine
  • VPN
  • Load balancer
  • Router
  • Project
  • Network
  • ISO
  • Volume
  • Template
  • Security group
  • User
  • Snapshot
  • Firewall
  • Account
  • NAT
  • VM group
  • Resource tag
  • Address
  • Zone
  • Disk offering
  • Hypervisor
  • Guest OS
slide-31
SLIDE 31

Abstractions to the rescue?

gareth rushgrove | morethanseven.net http://www.flickr.com/photos/uk_parliament/2701192648/
slide-32
SLIDE 32

Fog (Ruby)

gareth rushgrove | morethanseven.net

fog.io

slide-33
SLIDE 33

Fog primitives

gareth rushgrove | morethanseven.net
  • Compute
  • Storage
  • CDN
  • DNS
slide-34
SLIDE 34

libcloud (Python)

gareth rushgrove | morethanseven.net

libcloud.apache.org

slide-35
SLIDE 35

libcloud primitives

gareth rushgrove | morethanseven.net
  • Compute
  • Storage
  • Load balancers
  • DNS
slide-36
SLIDE 36

jclouds (Java)

gareth rushgrove | morethanseven.net

www.jclouds.org

slide-37
SLIDE 37

jclouds primitives

gareth rushgrove | morethanseven.net
  • Computeservice
  • Blob store
slide-38
SLIDE 38

Naming things is hard

gareth rushgrove | morethanseven.net

There are only two hard things in Computer Science: cache invalidation and naming things. Phil Karlton

“ ”

slide-39
SLIDE 39

Peril 4

Slipperly slope of Platform as a Service

http://www.flickr.com/photos/uk_parliament/2700327415
slide-40
SLIDE 40

Definitions

gareth rushgrove | morethanseven.net

...does not manage or control the underlying cloud infrastructure including network, servers, operating systems, or storage... ...does not manage or control the underlying cloud infrastructure but has control over operating systems, storage, and deployed applications; and possibly limited control of select networking components...

PaaS IaaS

slide-41
SLIDE 41

Platform as a Service

gareth rushgrove | morethanseven.net
slide-42
SLIDE 42

Not PaaS

gareth rushgrove | morethanseven.net
slide-43
SLIDE 43

Heroku

gareth rushgrove | morethanseven.net
slide-44
SLIDE 44

Heroku

gareth rushgrove | morethanseven.net
slide-45
SLIDE 45

Amazon Elastic Beanstalk

gareth rushgrove | morethanseven.net
slide-46
SLIDE 46

Amazon Elastic Beanstalk

gareth rushgrove | morethanseven.net
slide-47
SLIDE 47

Amazon EC2

gareth rushgrove | morethanseven.net
slide-48
SLIDE 48

Amazon EC2

gareth rushgrove | morethanseven.net
slide-49
SLIDE 49

vCloud Director

gareth rushgrove | morethanseven.net
slide-50
SLIDE 50

vCloud Director

gareth rushgrove | morethanseven.net
slide-51
SLIDE 51

Amazon DynamoDB

gareth rushgrove | morethanseven.net
slide-52
SLIDE 52

Amazon DynamoDB

gareth rushgrove | morethanseven.net
slide-53
SLIDE 53

Amazon ElastiCache

gareth rushgrove | morethanseven.net
slide-54
SLIDE 54

Amazon ElastiCache

gareth rushgrove | morethanseven.net
slide-55
SLIDE 55

Peril 5

Vendor lock-in

slide-56
SLIDE 56

Capability lock-in

gareth rushgrove | morethanseven.net
slide-57
SLIDE 57

Capacity lock-in

gareth rushgrove | morethanseven.net
slide-58
SLIDE 58

Ecosystem lock-in

gareth rushgrove | morethanseven.net http://www.flickr.com/photos/uk_parliament/2700549757/
slide-59
SLIDE 59 http://www.flickr.com/photos/iancarroll/5027441664

Interlude

The story of GOV.UK

slide-60
SLIDE 60 gareth rushgrove | morethanseven.net

Government is Big

464,000 55,000

UK Civil Service Google

19,995

BBC

x8 x23

slide-61
SLIDE 61

Martha Lane-Fox Report - October 2010

gareth rushgrove | morethanseven.net
slide-62
SLIDE 62

Alpha - June 2011

gareth rushgrove | morethanseven.net
slide-63
SLIDE 63

Me - September 2011

gareth rushgrove | morethanseven.net
slide-64
SLIDE 64

GDS

Government Digital Service - December 2011

gareth rushgrove | morethanseven.net
slide-65
SLIDE 65

Beta - January 2012

gareth rushgrove | morethanseven.net
slide-66
SLIDE 66

Design Principles - April 2012

gareth rushgrove | morethanseven.net
slide-67
SLIDE 67 gareth rushgrove | morethanseven.net

Why Infrastructure as a Service?

digital.cabinetoffice.gov.uk/2012/09/25/why-iaas/

slide-68
SLIDE 68 gareth rushgrove | morethanseven.net

G-Cloud Procurement Framework

gcloud.civilservice.gov.uk

slide-69
SLIDE 69 gareth rushgrove | morethanseven.net

EC2 to VMWare

http://www.flickr.com/photos/uk_parliament/2701203048/
slide-70
SLIDE 70

GOV.UK - October 2012

gareth rushgrove | morethanseven.net
slide-71
SLIDE 71

Government Digital Strategy - November 2012

gareth rushgrove | morethanseven.net

publications.cabinetoffice.gov.uk/digital/

slide-72
SLIDE 72

13 of 24 Departments - So far

gareth rushgrove | morethanseven.net
slide-73
SLIDE 73 http://www.flickr.com/photos/iancarroll/5027441664

Solutions?

What can we do

slide-74
SLIDE 74

Solution 1

Infrastructure as code

http://www.flickr.com/photos/uk_parliament/2700327415
slide-75
SLIDE 75 gareth rushgrove | morethanseven.net

Configuration Management

slide-76
SLIDE 76 gareth rushgrove | morethanseven.net

Chef opscode.com

slide-77
SLIDE 77 gareth rushgrove | morethanseven.net

Chef code example

cookbook_file "#{home_dir}/.ssh/authorized_keys" do source "authorized_keys" mode "0600"

  • wner username

group username end group "sysadmin" do members ["garethr"] end

slide-78
SLIDE 78 gareth rushgrove | morethanseven.net

CFEngine cfengine.com

slide-79
SLIDE 79 gareth rushgrove | morethanseven.net

CFEngine code example

bundle agent test { packages: redhat:: "wget" package_policy => "addupdate", package_method => yum, package_select => ">=", package_version => "1.11.4-2.el5_4.1", package_architectures => { "x86_64" }; }

slide-80
SLIDE 80 gareth rushgrove | morethanseven.net

Puppet puppetlabs.com

slide-81
SLIDE 81

package { 'apache2': ensure => latest, } service { 'apache2': ensure => running, provider => upstart, require => Package['apache2'] }

gareth rushgrove | morethanseven.net

Resources

slide-82
SLIDE 82

class govuk::apps::calendars( $port = 3011 ) { govuk::app { 'calendars': app_type => 'rack', port => $port, health_check_path => ‘/bank-holidays’, } }

gareth rushgrove | morethanseven.net

Applications

slide-83
SLIDE 83

class govuk::node::s_frontend inherits govuk::node::s_base include govuk::node::s_ruby_app_server include govuk::apps::businesssupportfinder include govuk::apps::calendars include govuk::apps::canary_frontend include govuk::apps::datainsight_frontend include govuk::apps::designprinciples include govuk::apps::feedback include govuk::apps::frontend include govuk::apps::licencefinder include govuk::apps::smartanswers include govuk::apps::static include govuk::apps::tariff

gareth rushgrove | morethanseven.net

Node types

slide-84
SLIDE 84

class govuk::node::s_frontend inherits govuk::node::s_base { include govuk::node::s_ruby_app_server include govuk::apps::businesssupportfinder include govuk::apps::calendars include govuk::apps::canary_frontend include govuk::apps::datainsight_frontend include govuk::apps::designprinciples include govuk::apps::feedback include govuk::apps::frontend include govuk::apps::licencefinder include govuk::apps::smartanswers include govuk::apps::static include govuk::apps::tariff

gareth rushgrove | morethanseven.net

Include software on nodes

slide-85
SLIDE 85

class govuk::node::s_frontend inherits govuk::node::s_base { include govuk::node::s_ruby_app_server include govuk::apps::businesssupportfinder include govuk::apps::calendars include govuk::apps::canary_frontend include govuk::apps::datainsight_frontend include govuk::apps::designprinciples include govuk::apps::feedback include govuk::apps::frontend include govuk::apps::licencefinder include govuk::apps::smartanswers include govuk::apps::static include govuk::apps::tariff

gareth rushgrove | morethanseven.net

Include out applications on nodes

slide-86
SLIDE 86 gareth rushgrove | morethanseven.net

More on Infrastructure as Code

speakerdeck.com/garethr

slide-87
SLIDE 87

Solution 2

API abstractions

http://www.flickr.com/photos/uk_parliament/2700327415
slide-88
SLIDE 88 gareth rushgrove | morethanseven.net

libcloud

slide-89
SLIDE 89 gareth rushgrove | morethanseven.net

libcloud OpenStack example

from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver OpenStack = get_driver(Provider.OPENSTACK) driver = OpenStack('username', 'password', ex_force_auth_url='https://nova-api.trystack.org:5443/v2.0' ex_force_auth_version='2.0_password') nodes = driver.list_nodes() images = driver.list_images()

slide-90
SLIDE 90 gareth rushgrove | morethanseven.net

libcloud VCloud example

from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver vcloud = get_driver(Provider.VCLOUD) driver = vcloud('username', 'password', host='vcloud.local', api_version='1.5') nodes = driver.list_nodes() images = driver.list_images()

slide-91
SLIDE 91 gareth rushgrove | morethanseven.net

But abstractions leak

images = driver.list_images() sizes = driver.list_sizes() size = [s for s in sizes if s.ram == 512][0] image = [i for i in images if i.name == 'natty-amd64'][0] node = driver.create_node(name='test node', image=image, size=size)

slide-92
SLIDE 92 gareth rushgrove | morethanseven.net

But abstractions leak

images = driver.list_images() sizes = driver.list_sizes() size = [s for s in sizes if s.ram == 512][0] image = [i for i in images if i.name == 'natty-amd64'][0] node = driver.create_node(name='test node', image=image, size=size)

slide-93
SLIDE 93 gareth rushgrove | morethanseven.net

But abstractions leak take two

vcloud = get_driver(Provider.VCLOUD) driver = vcloud('username', 'password', host='vcloud.local', api_version='1.5') node = driver.create_node(name='test node 4', image=image, ex_vm_network='your vm net name', ex_network='your org net name', ex_vm_fence='bridged', ex_vm_ipmode='DHCP')

slide-94
SLIDE 94 gareth rushgrove | morethanseven.net

More capabilities, more leaks

vcloud = get_driver(Provider.VCLOUD) driver = vcloud('username', 'password', host='vcloud.local', api_version='1.5') node = driver.create_node(name='test node 4', image=image, ex_vm_network='your vm net name', ex_network='your org net name', ex_vm_fence='bridged', ex_vm_ipmode='DHCP')

slide-95
SLIDE 95 gareth rushgrove | morethanseven.net

Fog

slide-96
SLIDE 96 gareth rushgrove | morethanseven.net

jclouds

slide-97
SLIDE 97

Solution 3

Config managent plus APIs

http://www.flickr.com/photos/uk_parliament/2700327415
slide-98
SLIDE 98 gareth rushgrove | morethanseven.net

Pallet

github.com/pallet/pallet

slide-99
SLIDE 99 gareth rushgrove | morethanseven.net

Pallet code example

(use 'pallet.crate.java) (defnode webserver {} :configure (phase (java :openjdk))) (converge {webserver 10} :compute service)

slide-100
SLIDE 100 gareth rushgrove | morethanseven.net

Ironfan

github.com/infochimps-labs/ironfan

slide-101
SLIDE 101 gareth rushgrove | morethanseven.net

Ironfan example

Ironfan.cluster 'web_demo' do cloud(:ec2) do flavor 't1.micro' end role :base_role facet :dbnode do instances 2 role :mysql_server end end

slide-102
SLIDE 102 gareth rushgrove | morethanseven.net

puppet-iaas

github.com/garethr/garethr-iaas

slide-103
SLIDE 103 gareth rushgrove | morethanseven.net

Cloud instances as resources

server { 'web-server': ensure => present, count => 5, provider => brightbox, image => 'img-q6gc8', # ubuntu 12.04 }

slide-104
SLIDE 104 gareth rushgrove | morethanseven.net

Switch the provider

server { 'web-server': ensure => present, count => 5, provider => rackspace, image => 'img-q6gc8', # ubuntu 12.04 }

slide-105
SLIDE 105 gareth rushgrove | morethanseven.net

Leaky interface

server { 'web-server': ensure => present, count => 5, provider => rackspace, image => '5cebb13a-f783-4f8c-8058 c4182c724ccd' flavor => 2, # 512 MB }

slide-106
SLIDE 106 gareth rushgrove | morethanseven.net

Vagrant 1.1

vagrantup.com

slide-107
SLIDE 107 gareth rushgrove | morethanseven.net

Define our instance

Vagrant::Config.run do |config| config.vm.box = "precise64" config.vm.forward_port 5555, 5555 config.vm.forward_port 5556, 5556 config.vm.forward_port 4567, 4567 config.vm.provision :puppet do |puppet| puppet.manifests_path = "manifests" puppet.module_path = "modules" puppet.manifest_file = "site.pp" end end

slide-108
SLIDE 108 gareth rushgrove | morethanseven.net

Configure different providers

Vagrant.configure("2") do |config| config.vm.box = "precise64" config.vm.provider :vmware_fusion do |v| v.vmx["memsize"] = "1024" end config.vm.provider :aws do |aws| aws.instance_type = "m1.small" end end

slide-109
SLIDE 109 gareth rushgrove | morethanseven.net

Choose your own provider $ vagrant up --provider=virtualbox

slide-110
SLIDE 110 gareth rushgrove | morethanseven.net

Switch your provider $ vagrant up --provider=ec2

slide-111
SLIDE 111

Solution 4

Software defined networks

http://www.flickr.com/photos/uk_parliament/2700327415
slide-112
SLIDE 112 gareth rushgrove | morethanseven.net

Ruby DSL

require 'rubygems' require 'nat' nat do snat :interface => "Client Data", :original => { :ip => "10.0.0.0/xx" }, :translated => { :ip => "xx.xx.xx.xx" }, :desc => "Outbound internet traffic" dnat :interface => "Client Data", :original => { :ip => "xx.xx.xx.xx", :port => 22 }, :translated => { :ip => "10.0.0.xx", :port => 22 }, :desc => "jumpbox-1 SSH" dnat :interface => "Client Data", :original => { :ip => "xx.xx.xx.xx", :port => 80 },, :translated => { :ip => "10.0.0.xx", :port => 80 }, :desc => "jenkins, logging, monitoring HTTP"

slide-113
SLIDE 113

require 'rubygems' require 'firewall' firewall do # internal rules rule "ssh access to jumpbox1" do source :ip => "Any" destination :ip => "xx.xx.xx.xx", :port => 22 end rule "http to backend applications" do source :ip => "Any" destination :ip => "xx.xx.xx.xx", :port => 80 end rule "https to backend applications" do

gareth rushgrove | morethanseven.net

Including Firewall and Loadbalancer

slide-114
SLIDE 114 http://www.flickr.com/photos/iancarroll/5027441664

Conclusions

if all you remember is

slide-115
SLIDE 115 http://www.flickr.com/photos/kevharb/5314268567 gareth rushgrove | morethanseven.net

Solve the problem for the complex case

slide-116
SLIDE 116 gareth rushgrove | morethanseven.net

Focus on capabilities over APIs

http://www.flickr.com/photos/sprengben/5136170057
slide-117
SLIDE 117

The End

slide-118
SLIDE 118 gareth rushgrove | morethanseven.net

Thanks for the photos

slide-119
SLIDE 119

Questions?

gareth rushgrove | morethanseven.net http://flickr.com/photos/psd/102332391/
slide-120
SLIDE 120

QCon session code

gareth rushgrove | morethanseven.net

4172