November 23, 2017


# Create a virtual guest object.
# createObject() enables the creation of computing instances on an account. This
# method is a simplified alternative to interacting with the ordering system directly.
# In order to create a computing instance, a template object must be sent in with a few required values.
# When this method returns an order will have been placed for a computing instance of the specified configuration.
# To determine when the instance is available you can poll the instance via getObject, with an object mask requesting
# the provisionDate relational property. When provisionDate is not null, the instance will be ready.
# Warning: Computing instances created via this method will incur charges on your account. For testing input parameters
# see generateOrderTemplate.
# Input - SoftLayer_Virtual_Guest
# Important manual pages:
# License:
# Author: SoftLayer Technologies, Inc. <>

require 'rubygems'
require 'softlayer_api'
require 'awesome_print'

virtual_guest = {
        hostname: 'vs574DC',
        domain: 'softlayer.local',
        startCpus: 1,
        maxMemory: 1024,
        datacenter: {
            name: 'dal05'
        hourlyBillingFlag: true,
        localDiskFlag: true,
        operatingSystemReferenceCode: 'UBUNTU_LATEST'

SL_API_USERNAME = 'set me'
SL_API_KEY = 'set me'

                               api_key: SL_API_KEY)

virtual_guest_service = client['SoftLayer_Virtual_Guest']

  virtual_guest = virtual_guest_service.createObject(virtual_guest)
  ap virtual_guest
rescue StandardError => e
  p 'Error when executing the script...'


If this article contains any error, or leaves any of your questions unanswered, please help us out by opening up a github issue.
Open an issue