cutting through the fog of cloud
DESCRIPTION
In this presentation, I am going to briefly talk about 'what cloud is' and highlight the various types of cloud (IaaS, PaaS, SaaS). The bulk of the talk will be about using the fog gem using IaaS. I will discuss fog concepts (collections, models, requests, services, providers) and supporting these with actual examples using fogTRANSCRIPT
![Page 1: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/1.jpg)
Cutting Through The Fog Of Cloud
Kyle RamesDeveloper Advocate@krames
![Page 2: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/2.jpg)
Agenda
• Cloud 101
• Working in the Clouds
![Page 3: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/3.jpg)
What is Cloud?
![Page 4: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/4.jpg)
![Page 5: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/5.jpg)
![Page 6: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/6.jpg)
Software as a Service SaaS
![Page 7: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/7.jpg)
Platform as a Service PaaS
![Page 8: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/8.jpg)
Infrastructure as a Service IaaS
![Page 9: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/9.jpg)
Types of Cloud
SaaS
PaaS
IaaS
![Page 10: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/10.jpg)
When I say Cloud,you think...
![Page 11: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/11.jpg)
![Page 12: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/12.jpg)
![Page 13: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/13.jpg)
![Page 14: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/14.jpg)
When I say Cloud,you think...
![Page 15: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/15.jpg)
![Page 16: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/16.jpg)
![Page 17: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/17.jpg)
Agenda
• Cloud 101
• Working in the Clouds
![Page 18: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/18.jpg)
source: https://www.ruby-toolbox.com/projects/fog
![Page 19: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/19.jpg)
Fog Providers>> Fog.providers.keys
=> [:atmos, :aws, :baremetalcloud, :bluebox,:brightbox, :clodo, :cloudsigma, :cloudstack, :digitalocean, :dnsimple, :dnsmadeeasy, :dreamhost, :dynect, :ecloud, :glesys, :gogrid, :google, :hp, :ibm, :internetarchive, :joyent, :libvirt, :linode, :local, :ninefold, :openstack, :openvz, :ovirt, :rackspace, :riakcs, :serverlove, :stormondemand, :vcloud, :vmfusion, :voxel, :vsphere, :xenserver, :zerigo]
![Page 20: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/20.jpg)
Rackspace Services>> Fog.services.select {|k,v| v.include?(:rackspace) }.keys
=> [:storage, :cdn, :compute, :dns, :block_storage, :compute_v2, :load_balancers, :identity, :databases]
![Page 21: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/21.jpg)
Load Balancer
VMVM
DNSbespin-mining.com
![Page 22: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/22.jpg)
VMVM
![Page 23: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/23.jpg)
Create Compute Service>> service = Fog::Compute.new { :provider => 'rackspace', :version => :v2, :rackspace_username => USERNAME, :rackspace_api_key => API_KEY, :rackspace_region => :ord
![Page 24: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/24.jpg)
Required Server Parameters
![Page 25: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/25.jpg)
Get List of Images>> images = service.images
=> <Fog::Compute::RackspaceV2::Images [ <Fog::Compute::RackspaceV2::Image id="ccaf99bc-‐472a-‐46ea-‐a125-‐d3ecfca66695", name="FreeBSD 9.1", ...>, <Fog::Compute::RackspaceV2::Image id="16e6c0ae-‐f881-‐4180-‐95b0-‐3450fe3f8e96", name="Red Hat Enterprise Linux 6.4", ...>, ... ]>
![Page 26: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/26.jpg)
Get Ubuntu Image>> image = images.find do |img| img.name =~ /Ubuntu/ end => <Fog::Compute::RackspaceV2::Image id="23cebbc9-‐3219-‐4a27-‐9210-‐d63e1af7181b", name="Ubuntu 13.04 (Raring Ringtail)", ... >
![Page 27: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/27.jpg)
Get Flavor>> flavor = service.flavors.first
=> <Fog::Compute::RackspaceV2::Flavor id="2", name="512MB Standard Instance", ram=nil, disk=nil, vcpus=nil, links=[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/2", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/2", "rel"=>"bookmark"}]
![Page 28: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/28.jpg)
![Page 29: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/29.jpg)
TK-421
![Page 30: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/30.jpg)
Create Server>> tk_421 = service.servers.create { :image_id => image.id, :flavor_id => flavor.id, :name => 'TK-‐421'}
=> <Fog::Compute::RackspaceV2::Server id="308e5fd5-‐ff50-‐42bd-‐911c-‐b91a9180673d", name="TK-‐421", created=nil, updated=nil, host_id=nil, state=nil, progress=nil, ...>
![Page 31: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/31.jpg)
Update Server Object>> tk_421.reload
=> <Fog::Compute::RackspaceV2::Server id="308e5fd5-‐ff50-‐42bd-‐911c-‐b91a9180673d", name="TK-‐421", created="2013-‐07-‐03T18:08:40Z", updated="2013-‐07-‐03T18:08:43Z", host_id="", state="BUILD", progress=0, ...>
![Page 32: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/32.jpg)
Server Attributes>> tk_421.attributes
=> {:image_id=>"23cebbc9-‐3219-‐4a27-‐9210-‐d63e1af7181b", :flavor_id=>"2", :name=>"TK-‐421", :disk_config=>"AUTO", :id=>"308e5fd5-‐ff50-‐42bd-‐911c-‐b91a9180673d" :state=>"BUILD", :progress=>0, ...}
![Page 33: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/33.jpg)
Fog Meta Magic>> tk_421.state=> "BUILD"
>> tk_421.progress=> 0
![Page 34: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/34.jpg)
Is it ready?>> tk_421.reload
>> tk_421.state=> "BUILD"
>> tk_421.progress=> 17
![Page 35: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/35.jpg)
Waiting for TK-421>> tk_421.wait_for { ready? }
=> {:duration=>197.0}
![Page 36: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/36.jpg)
Login>> tk_421.username=> “root”
>> tk_421.password=> “r3b3lz-‐st1nk42”
![Page 37: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/37.jpg)
Bootstrap
1. Creates server
2. Waits for server to finish building
3. Create ROOT_USER/.ssh/authorized_keys
4. Lock password for root user
5. Create ROOT_USER/attributes.json file
6. Create ROOT_USER/metadata.json file
![Page 38: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/38.jpg)
Bootstrap>> tk_422 = service.servers.bootstrap { :image_id => image.id, :flavor_id => flavor.id, :name => 'TK-‐422', :public_key_path => '~/.ssh/fog_rsa.pub', :private_key_path => '~/.ssh/fog_rsa' }
![Page 39: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/39.jpg)
SCP / SSH>> tk_422.scp 'setup.sh', '/root/setup.sh'
>> results = tk_422.ssh ‘sh /root/setup.sh’
>> results.first.stdout=> "Setting up VM\r\n"
![Page 40: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/40.jpg)
We have only scratched the surface!
![Page 41: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/41.jpg)
![Page 42: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/42.jpg)
Remember?
service.images
![Page 43: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/43.jpg)
Collection
Array
Fog::Collection
Fog::Compute::RackspaceV2::Images
![Page 44: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/44.jpg)
Collection Methodsall fetch every object of that type from the
provider.
get fetch a single object by its identity from the provider.
create initialize a new record locally and a remote resource with the provider.
new initialize a new record locally, but do not create a remote resource with the provider.
![Page 45: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/45.jpg)
Collections
>> service.collections
[:servers, :flavors, :images, :attachments, :networks]
![Page 46: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/46.jpg)
Model
Fog::Model
Fog::Compute::RackspaceV2:Image
![Page 47: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/47.jpg)
Model Methodsattributes Returns a hash containing the list of model
attributes and values.
save Saves object. (not all object support update)
reload Updates object with latest state from service.
ready? Returns true if object is in a ready state and able to perform actions.
wait_for Periodically reloads model yielding to block.
![Page 48: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/48.jpg)
Model Layer
![Page 49: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/49.jpg)
VMVM
![Page 50: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/50.jpg)
Load Balancer
VMVM
![Page 51: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/51.jpg)
Create Load Balancer Service
>> lb_service = Fog::Rackspace::LoadBalancers.new { :rackspace_username => USERNAME, :rackspace_api_key => API_KEY, :rackspace_region => :ord }
![Page 52: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/52.jpg)
Load Balancer Collections
>> lb_service.collections
=> [:load_balancers, :nodes, :virtual_ips, :access_rules]
![Page 53: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/53.jpg)
Creating a Load Balancer
lb = lb_service.load_balancers.
![Page 54: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/54.jpg)
Creating a Load Balancer
lb = lb_service.load_balancers.create :name => 'bob-‐the-‐balancer', :protocol => 'HTTP', :port => 80, :virtual_ips => [{:type => 'PUBLIC'}], :nodes => [{ :address => tk_421.ipv4_address, :port => 80, :condition => 'ENABLED' }]
![Page 55: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/55.jpg)
Add Additional Nodelb.nodes.
![Page 56: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/56.jpg)
Add Additional Nodelb.nodes.create {:address => tk_422.ipv4_address, :port => 80, :condition => 'ENABLED'}
![Page 57: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/57.jpg)
IP Address>> vip = lb.virtual_ips.find do |ip| ip.ip_version == "IPV4" end
>> vip.address=> "166.78.41.240"
![Page 58: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/58.jpg)
Continuous Deployment[tk_602, tk_603].each do |server| lb.nodes.create(:address => server.ipv4_address, :port => 80, :condition => 'ENABLED')end
existing_nodes.each do |node| node.condition = 'DRAINING' node.saveend
![Page 59: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/59.jpg)
![Page 60: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/60.jpg)
Request Layer
![Page 61: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/61.jpg)
Request Layer
• Mirrors REST interface
• Most efficient way to access cloud
• Not portable between providers
• Preference model layer!
![Page 62: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/62.jpg)
Requests>> service.requests
[:copy_object, :delete_container, :delete_object, :get_container, :get_containers, :get_object,
...]
![Page 63: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/63.jpg)
Load Balancer
VMVM
![Page 64: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/64.jpg)
Load Balancer
VMVM
DNSbespin-mining.com
![Page 65: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/65.jpg)
Create DNS Service>> service = Fog::DNS.new { :provider => 'rackspace', :rackspace_username => USERNAME, :rackspace_api_key => API_KEY }
![Page 66: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/66.jpg)
DNS Requests>> dns_service.requests
=> [:callback, :list_domains, :list_domain_details, :modify_domain, :create_domains, :remove_domain, :remove_domains, :list_subdomains, :list_records, :list_record_details, :modify_record, :remove_record, :remove_records, :add_records]
![Page 67: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/67.jpg)
List Domains>> r = service.list_domains
#<Excon::Response:0x007fdf1ea0f7d0 @data={:body=>{"domains"=>[{"name"=>"bespin-‐mining.com", "id"=>3753036, "accountId"=>772045, "emailAddress"=>"[email protected]", "updated"=>"2013-‐06-‐17T15:52:29.000+0000", "created"=>"2013-‐06-‐17T15:52:29.000+0000"},..]}} @headers={"Content-‐Type"=>"application/json", "Via"=>"1.1 Repose (Repose/2.6.11)", "x-‐api-‐version"=>"1.0.25", "Content-‐Length"=>"1509", "Date"=>"Fri, 05 Jul 2013 18:43:12 GMT", "Server"=>"Jetty(8.0.y.z-‐SNAPSHOT)"}, @status=200, @remote_ip="50.56.3.32">
![Page 68: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/68.jpg)
List Domains>> r = service.list_domains
#<Excon::Response:0x007fdf1ea0f7d0 @data={:body=>{"domains"=>[{"name"=>"bespin-‐mining.com", "id"=>3753036, "accountId"=>772045, "emailAddress"=>"[email protected]", "updated"=>"2013-‐06-‐17T15:52:29.000+0000", "created"=>"2013-‐06-‐17T15:52:29.000+0000"},..]}} @headers={"Content-‐Type"=>"application/json", "Via"=>"1.1 Repose (Repose/2.6.11)", "x-‐api-‐version"=>"1.0.25", "Content-‐Length"=>"1509", "Date"=>"Fri, 05 Jul 2013 18:43:12 GMT", "Server"=>"Jetty(8.0.y.z-‐SNAPSHOT)"}, @status=200, @remote_ip="50.56.3.32">
![Page 69: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/69.jpg)
List Domains>> r = service.list_domains
#<Excon::Response:0x007fdf1ea0f7d0 @data={:body=>{"domains"=>[{"name"=>"bespin-‐mining.com", "id"=>3753036, "accountId"=>772045, "emailAddress"=>"[email protected]", "updated"=>"2013-‐06-‐17T15:52:29.000+0000", "created"=>"2013-‐06-‐17T15:52:29.000+0000"},..]}} @headers={"Content-‐Type"=>"application/json", "Via"=>"1.1 Repose (Repose/2.6.11)", "x-‐api-‐version"=>"1.0.25", "Content-‐Length"=>"1509", "Date"=>"Fri, 05 Jul 2013 18:43:12 GMT", "Server"=>"Jetty(8.0.y.z-‐SNAPSHOT)"}, @status=200, @remote_ip="50.56.3.32">
![Page 70: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/70.jpg)
List Domains>> r = service.list_domains
#<Excon::Response:0x007fdf1ea0f7d0 @data={:body=>{"domains"=>[{"name"=>"bespin-‐mining.com", "id"=>3753036, "accountId"=>772045, "emailAddress"=>"[email protected]", "updated"=>"2013-‐06-‐17T15:52:29.000+0000", "created"=>"2013-‐06-‐17T15:52:29.000+0000"},..]}} @headers={"Content-‐Type"=>"application/json", "Via"=>"1.1 Repose (Repose/2.6.11)", "x-‐api-‐version"=>"1.0.25", "Content-‐Length"=>"1509", "Date"=>"Fri, 05 Jul 2013 18:43:12 GMT", "Server"=>"Jetty(8.0.y.z-‐SNAPSHOT)"}, @status=200, @remote_ip="50.56.3.32">
![Page 71: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/71.jpg)
Excon::Response>> domain = r.body["domains"].find do |h| h["name"] == "bespin-‐mining.com"end
=> {"name"=>"bespin-‐mining.com", "id"=>3753036, "accountId"=>772045, "emailAddress"=>"[email protected]", "updated"=>"2013-‐07-‐05T19:07:42.000+0000", "created"=>"2013-‐06-‐17T15:52:29.000+0000"}
>> r.status=> 200
![Page 72: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/72.jpg)
Adding A Record>> vip = lb.virtual_ips.find {|ip| ip.ip_version == "IPV4" }
>> service.add_records domain[“id”], [{ :name => 'bespin-‐mining.com', :type => 'A', :data => vip.address, :ttl => 600}]
![Page 73: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/73.jpg)
Load Balancer
VMVM
DNSbespin-mining.com
![Page 74: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/74.jpg)
![Page 75: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/75.jpg)
Fog deep dive
![Page 76: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/76.jpg)
Retrieve Image
service.images.get "23cebbc9-‐3219-‐4a27-‐9210-‐d63e1af7181b"
![Page 77: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/77.jpg)
module Fog module Compute class RackspaceV2
class Images < Fog::Collection
def get(image_id) data = service.get_image(image_id).body['image'] new(data) rescue Fog::Compute::RackspaceV2::NotFound nil end
end
end endend
![Page 78: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/78.jpg)
module Fog module Compute class RackspaceV2
class Images < Fog::Collection
def get(image_id) data = service.get_image(image_id).body['image'] new(data) rescue Fog::Compute::RackspaceV2::NotFound nil end
end
end endend
![Page 79: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/79.jpg)
module Fog module Compute class RackspaceV2
class Real def get_image(image_id) request( :expects => [200, 203], :method => 'GET', :path => "images/#{image_id}" ) end
end endend
![Page 80: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/80.jpg)
module Fog module Compute class RackspaceV2
class Real def get_image(image_id) request( :expects => [200, 203], :method => 'GET', :path => "images/#{image_id}" ) end
end endend
![Page 81: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/81.jpg)
module Fog module Compute class RackspaceV2
class Real def get_image(image_id) request( :expects => [200, 203], :method => 'GET', :path => "images/#{image_id}" ) end
end endend
![Page 82: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/82.jpg)
module Fog module Compute class RackspaceV2
class Real def get_image(image_id) request( :expects => [200, 203], :method => 'GET', :path => "images/#{image_id}" ) end
end endend
![Page 83: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/83.jpg)
GET https://ord.servers.api.rackspacecloud.com:443/v2/5555/images/23cebbc9-3219-4a27-9210-d63e1af7181b HTTP/1.1Content-Type: application/jsonAccept: application/jsonX-Auth-Token: abc41dc54e594e9c8fb73b89b1b79142Host: ord.servers.api.rackspacecloud.com:443
![Page 84: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/84.jpg)
GET https://ord.servers.api.rackspacecloud.com:443/v2/5555/images/23cebbc9-3219-4a27-9210-d63e1af7181b HTTP/1.1Content-Type: application/jsonAccept: application/jsonX-Auth-Token: abc41dc54e594e9c8fb73b89b1b79142Host: ord.servers.api.rackspacecloud.com:443
![Page 85: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/85.jpg)
GET https://ord.servers.api.rackspacecloud.com:443/v2/5555/images/23cebbc9-3219-4a27-9210-d63e1af7181b HTTP/1.1Content-Type: application/jsonAccept: application/jsonX-Auth-Token: abc41dc54e594e9c8fb73b89b1b79142Host: ord.servers.api.rackspacecloud.com:443
![Page 86: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/86.jpg)
GET https://ord.servers.api.rackspacecloud.com:443/v2/5555/images/23cebbc9-3219-4a27-9210-d63e1af7181b HTTP/1.1Content-Type: application/jsonAccept: application/jsonX-Auth-Token: abc41dc54e594e9c8fb73b89b1b79142Host: ord.servers.api.rackspacecloud.com:443
![Page 87: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/87.jpg)
GET https://ord.servers.api.rackspacecloud.com:443/v2/5555/images/23cebbc9-3219-4a27-9210-d63e1af7181b HTTP/1.1Content-Type: application/jsonAccept: application/jsonX-Auth-Token: abc41dc54e594e9c8fb73b89b1b79142Host: ord.servers.api.rackspacecloud.com:443
![Page 88: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/88.jpg)
GET https://ord.servers.api.rackspacecloud.com:443/v2/5555/images/23cebbc9-3219-4a27-9210-d63e1af7181b HTTP/1.1Content-Type: application/jsonAccept: application/jsonX-Auth-Token: abc41dc54e594e9c8fb73b89b1b79142Host: ord.servers.api.rackspacecloud.com:443
![Page 89: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/89.jpg)
EXCON_DEBUG=true
![Page 90: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/90.jpg)
![Page 91: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/91.jpg)
Fog.mock!
Testing
![Page 92: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/92.jpg)
RACKSPACE® HOSTING | WWW.RACKSPACE.COM
http://developer.rackspace.com/#[email protected]
@krames
Questions?
![Page 93: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/93.jpg)
Imagestule fog, marya, CC BY-SA 2.0
Clouds, Daniel Boyd, CC BY 2.0
Metroid II: Return of Samus, Michel Ngilen, CC BY-SA 2.0
Lego Mindstorms Kit, Marlon J. Manrique, CC BY 2.0
CD, Visual Pharm, CC BY-SA 2.0
Public Bikes, Richard Masoner / Cyclelicious, CC BY 2.0
PRIVATE, Rupert Ganzer, CC BY 2.0
Hybrid
Sorry We Are Not Open, Alan Levine, CC BY 2.0
We are, e1ther, CC BY 2.0
![Page 94: Cutting through the fog of cloud](https://reader033.vdocuments.mx/reader033/viewer/2022061223/54c5de2f4a79599f068b45f6/html5/thumbnails/94.jpg)
Images (cont)Yipwm_1b, Greg Goebel, CC BY-SA 2.0
Pause Button, GreenLantern33, CC BY-SA 2.0
3..., Cristiano Betta, CC BY-SA 2.0