Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Fog

 Fog

Getting started with the Fog cloud services library. Presented at the SDRuby monthly meeting on November 3, 2011

James Miller

October 26, 2011
Tweet

More Decks by James Miller

Other Decks in Technology

Transcript

  1. Amazon EC2 Amazon S3 Zerigo DNS RS Files RS Servers

    Amazon Cloudfront Amazon Route 53 Dynect DNS DNSimple Amazon RDS Linode Google Storage
  2. s3 = Fog::Storage.new( provider: "AWS", aws_access_key_id: "KEY", aws_secret_access_key: "SECRET" )

    gg = Fog::Storage.new( provider: "Google", google_storage_access_key_id: "KEY", google_storage_secret_access_key: "SECRET" ) rs = Fog::Storage.new( provider: "Rackspace", rackspace_api_key: "KEY", rackspace_auth_url: "URL", rackspace_username: "USERNAME" ) s3.put_object(bucket_name, object_name, data, options = {}) gg.put_object(bucket_name, object_name, data, options = {}) rs.put_object(container, object_name, data, options = {})
  3. s3.put_object(bucket_name, object_name, data, options = {}) gg.put_object(bucket_name, object_name, data, options

    = {}) rs.put_object(container, object_name, data, options = {}) Consistency Provider Flexibility
  4. ec2 = Fog::Compute.new( provider: "AWS", aws_access_key_id: "KEY", aws_secret_access_key: "SECRET" )

    rsc = Fog::Compute.new( provider: "Rackspace", rackspace_api_key: "KEY", rackspace_username: "SECRET" ) ec2.servers.create( flavor_id: "c1.medium", image_id: "ami-6936fb00", # Ubuntu 10.04 LTS key_name: "mykeyname", groups: ["default"], ) rsc.servers.create( flavor_id: 5, # 4GB Memory image_id: 49, # Ubuntu 10.04 LTS name: 'my_server_name' )
  5. DNS

  6. z = Fog::DNS::Zerigo.new( zerigo_email: "email", zerigo_token: "secret", scheme: "https", port:

    443 ) zone_id = z.create_zone("bensie.com", 14400, "pri_sec") .body["id"] z.create_host(zone_id, "CNAME", "ghs.google.com", hostname: "mail", ttl: 14400 )
  7. AWS Management Console RS Cloud Control Panel • Multi-step wizards

    • Missing features • Slow • One account at a time
  8. rds = Fog::AWS::RDS.new( aws_access_key_id: "KEY", aws_secret_access_key: "SECRET" ) rds.create_db_instance("my-db-instance" "AllocatedStorage"

    => 50, "AutoMinorVersionUpgrade" => false, "BackupRetentionPeriod" => 3, "DBInstanceClass" => "db.m1.large", "DBParameterGroupName" => "utf8", "Engine" => "mysql", "EngineVersion" => "5.5.12", "MasterUsername" => "username", "MasterUserPassword" => "password", "MultiAZ" => true )
  9. rds = Fog::AWS::RDS.new( aws_access_key_id: "KEY", aws_secret_access_key: "SECRET" ) rds.create_db_parameter_group( "utf8",

    "mysql5.5", "utf8" ) rds.modify_db_parameter_group("utf8", [ { "ParameterName" => "character_set_server", "ParameterValue" => "utf8", "ApplyMethod" => "immediate" }, { "ParameterName" => "collation_server", "ParameterValue" => "utf8_general_ci", "ApplyMethod" => "immediate" } ] )
  10. elb = Fog::AWS::ELB.new( aws_access_key_id: "KEY", aws_secret_access_key: "SECRET" ) load_balancers =

    elb.describe_load_balancers .body["DescribeLoadBalancersResult"] ["LoadBalancerDescriptions"] load_balancers.each do |lb| elb.register_instances_with_load_balancer( ["i-3dcba453", "i-37cba459"], lb["LoadBalancerName"] ) end