# File lib/clouddb/connection.rb, line 114
    def create_instance(options = {})
      body = Hash.new
      body[:instance] = Hash.new

      body[:instance][:flavorRef]  = options[:flavor_ref] or raise CloudDB::Exception::MissingArgument, "Must provide a flavor to create an instance"
      body[:instance][:name]       = options[:name] or raise CloudDB::Exception::MissingArgument, "Must provide a name to create an instance"
      body[:instance][:volume]     = options[:volume] or raise CloudDB::Exception::MissingArgument, "Must provide a size to create an instance"
      body[:instance][:databases]  = options[:databases] if options[:databases]
      body[:instance][:users]      = options[:users] if options[:users]
      (raise CloudDB::Exception::Syntax, "Instance name must be 128 characters or less") if options[:name].size > 128

      response = dbreq("POST", dbmgmthost, "#{dbmgmtpath}/instances", dbmgmtport, dbmgmtscheme, {}, body.to_json)
      CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)
      body = JSON.parse(response.body)['instance']
      return get_instance(body["id"])
    end