# File lib/deltacloud/drivers/sbc/sbc_driver.rb, line 72
  def create_instance(credentials, image_id, opts={})
    sbc_client = new_client(credentials)

    # Copy opts to body; keywords are mapped later
    body = opts.dup
    body.delete('image_id')
    body.delete('hwp_id')
    body.delete('realm_id')

    # Lookup image if nil; tries to avoids extra lookup
    if @last_image.nil? || @last_image['id'] != opts[:image_id]
      @last_image = sbc_client.list_images(image_id).map[0]
    end

    # Map DeltaCloud keywords to SBC
    body['imageID'] = opts[:image_id]
    body['location'] = opts[:realm_id] || @last_image['location']
    body['instanceType'] = opts[:hwp_id].gsub('-', '/') || @last_image['supportedInstanceTypes'][0]['id']

    if not body['name']
      body['name'] = Time.now.to_i.to_s
    end

    # Submit instance, parse response
    convert_instance(sbc_client.create_instance(body).map[0])
  end