Create a new computing instance
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 SoftLayer_Virtual_Guest::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 SoftLayer_Virtual_Guest::generateOrderTemplate.
Hostname
String Required
Domain
String Required
startCpus
Integer Required
maxMemory
Integer Required
datacenter.name
String Required
"datacenter": {"name": "dal05"}
hourlyBillingFlag
Boolean Required
localDiskFlag
Boolean Required
dedicatedAccountHostOnlyFlag
Boolean
operatingSystemReferenceCode
String Conditionally required
blockDeviceTemplateGroup.globalIdentifier
, as the template will have its own operating system.blockDeviceTemplateGroup.globalIdentifier
String
operatingSystemReferenceCode
"blockDeviceTemplateGroup": { globalIdentifier": "07beadaa-1e11-476e-a188-3f7795feb9fb"
networkComponents.maxSpeed
Integer
networkComponents
property is an array with a single SoftLayer_Virtual_Guest_Network_Component structure.
The maxSpeed
property must be set to specify the network uplink speed, in megabits per second, of the computing instance."networkComponents": [{"maxSpeed": 1000}]
privateNetworkOnlyFlag
Boolean
primaryNetworkComponent.networkVlan.id
Integer
primaryNetworkComponent
property is a SoftLayer_Virtual_Guest_Network_Component structure with the networkVlan
property populated with a i
SoftLayer_Network_Vlan structure. The id
property must be set to specify the frontend network vlan of the computing instance.id
, NOT the vlan number."primaryNetworkComponent":{"networkVlan": {"id": 1234567}}
backendNetworkComponent.networkVlan.id
Integer
backendNetworkComponent
property is a SoftLayer_Virtual_Guest_Network_Component structure with the networkVlan
property populated with a
SoftLayer_Network_Vlan structure. The id
property must be set to specify the backend network vlan of the computing instance.id
, NOT the vlan number."backendNetworkComponent":{"networkVlan": {"id": 1234567}}
primaryNetworkComponent.securityGroupBindings
SoftLayer_Virtual_Network_SecurityGroup_NetworkComponentBinding[]
primaryNetworkComponent
property is a SoftLayer_Virtual_Guest_Network_Component structure with the securityGroupBindings
property populated
with an array of SoftLayer_Virtual_Network_SecurityGroup_NetworkComponentBinding structures. The securityGroup
property in each must be set to
specify the security group to be attached to the primary frontend network component."primaryNetworkComponent": {
"securityGroupBindings": [
{"securityGroup":{"id": 5555555}},
{"securityGroup":{"id": 1112223}},
]
}
primaryBackendNetworkComponent.securityGroupBindings
SoftLayer_Virtual_Network_SecurityGroup_NetworkComponentBinding[]
primaryNetworkComponent
property is a SoftLayer_Virtual_Guest_Network_Component structure with the securityGroupBindings
property populated
with an array of SoftLayer_Virtual_Network_SecurityGroup_NetworkComponentBinding structures. The securityGroup
property in each must be set to
specify the security group to be attached to the primary frontend network component."primaryBackendNetworkComponent": {
"securityGroupBindings": [
{"securityGroup":{"id": 33322211}},
{"securityGroup":{"id": 77777222}},
]
}
blockDevices
SoftLayer_Virtual_Guest_Block_Device[]
blockDevices
property is an array of SoftLayer_Virtual_Guest_Block_Device structures. Each block device must specify the device
property
along with the diskImage
property, which is a SoftLayer_Virtual_Disk_Image structure with the capacity
property set. The device
number '1'
is reserved for the SWAP disk attached to the computing instance."blockDevices":[{"device": "0", "diskImage": {"capacity": 100}}],
"localDiskFlag": true
userData.value
String
userData
property is an array with a single SoftLayer_Virtual_Guest_Attribute structure with the value
property set to an arbitrary value.
This value can be retrieved via the SoftLayer_Resource_Metadata::getUserMetadata method from a request originating from the computing instance.
This is primarily useful for providing data to software that may be on the instance and configured to execute upon first boot."userData":[{"value": "testData"}]
sshKeys
SoftLayer_Security_Ssh_Key[]
sshKeys
property is an array of SoftLayer_Security_Ssh_Key structures with the id
property set to the value of an existing SSH key."sshKeys":[{"id": 1234567}]
postInstallScriptUri
String
REST Example:
curl -X POST -d '{
"parameters":[
{
"hostname": "host1",
"domain": "example.com",
"startCpus": 1,
"maxMemory": 1024,
"hourlyBillingFlag": true,
"localDiskFlag": true,
"operatingSystemReferenceCode": "UBUNTU_LATEST"
}
}' https://api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/createObject.json
HTTP/1.1 201 Created
Location: https://api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/1301396/getObject
{
"accountId": 232298,
"createDate": "2012-11-30T16:28:17-06:00",
"dedicatedAccountHostOnlyFlag": false,
"domain": "example.com",
"hostname": "host1",
"id": 1301396,
"lastPowerStateId": null,
"lastVerifiedDate": null,
"maxCpu": 1,
"maxCpuUnits": "CORE",
"maxMemory": 1024,
"metricPollDate": null,
"modifyDate": null,
"privateNetworkOnlyFlag": false,
"startCpus": 1,
"statusId": 1001,
"globalIdentifier": "2d203774-0ee1-49f5-9599-6ef67358dd31"
}
Name | Type | Description |
---|---|---|
templateObject | SoftLayer_Virtual_Guest | The SoftLayer_Virtual_Guest object that you wish to create. |
curl -g -u $SL_USER:$SL_APIKEY -X POST -d '{"parameters": [SoftLayer_Virtual_Guest]}' \
'https://api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/createObject'