How To Create Google Compute Engine Instance Using Fog In Ruby -
i try following code getting error,
server = connection.servers.create({ :name => "instance-#{time.now}", :image_name => "debian-7-wheezy-v20150325", :machine_type => "f1-micro", :zone_name => "us-central1-a", }) /home/vijay/.rvm/gems/ruby-2.0.0-p598/gems/fog-core-1.30.0/lib/fog/core/attributes.rb:151:in `requires': disks required operation (argumenterror) /home/vijay/.rvm/gems/ruby-2.0.0-p598/gems/fog-1.29.0/lib/fog/google/models/compute/server.rb:218:in `save' /home/vijay/.rvm/gems/ruby-2.0.0-p598/gems/fog-core-1.30.0/lib/fog/core/collection.rb:51:in `create' google_compute_engine.rb:11:in `<main>'
i think missing parameter required, can me solve problem.
first create disk:
disk = connection.disks.create({ :name => "my-disk", :zone_name => "us-central1-a", :size_gb => 10, :source_image => "debian-7-wheezy-v20150325"})
next create instance disk:
server = connection.servers.create({ :name => "my-server", :machine_type => "f1-micro", :zone_name => "us-central1-a", :disks => [disk.get_as_boot_disk]})
note can attach multiple disks @ instance creation.
Comments
Post a Comment