Skip to main content

instances

Creates, updates, deletes, gets or lists an instances resource.

Overview​

Nameinstances
TypeResource
Idovh.cloud.instances

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstringInstance id
namestringInstance name
flavor_idstringInstance flavor id (wire: flavorId)
image_idstringInstance image id (wire: imageId)
ssh_key_idstringInstance ssh key id (wire: sshKeyId)
availability_zonestringAvailability zone of the instance (wire: availabilityZone)
createdstring (date-time)Instance creation date
current_month_outgoing_trafficintegerInstance outgoing network traffic for the current month (in bytes) (wire: currentMonthOutgoingTraffic)
flavorobjectInstance flavor
imageobjectInstance image
ip_addressesarrayInstance IP addresses (wire: ipAddresses)
monthly_billingobjectInstance monthly billing status (wire: monthlyBilling)
operation_idsarrayIds of pending public cloud operations (wire: operationIds)
plan_codestringOrder plan code (wire: planCode)
regionstringInstance id
rescue_passwordstring (password)Rescue password if instance is in RESCUE status (wire: rescuePassword)
ssh_keyobjectInstance SSH key (wire: sshKey)
statusstringInstance status (ACTIVE, BUILD, BUILDING, DELETED, DELETING, ERROR, HARD_REBOOT, MIGRATING, PASSWORD, PAUSED, REBOOT, REBUILD, RESCUE, RESCUED, RESCUING, RESIZE, RESIZED, RESUMING, REVERT_RESIZE, SHELVED, SHELVED_OFFLOADED, SHELVING, SHUTOFF, SNAPSHOTTING, SOFT_DELETED, STOPPED, SUSPENDED, UNKNOWN, UNRESCUING, UNSHELVING, VERIFY_RESIZE)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectinstance_id, service_nameGet instance
listselectservice_nameregionGet instance
createinsertservice_name, flavor_id, name, regionCreate a new instance
updateupdateinstance_id, service_name, instance_nameAlter an instance
deletedeleteinstance_id, service_nameDelete an instance
bulkexecservice_name, flavorId, name, number, regionCreate multiple instances
active_monthly_billingexecinstanceId, service_nameActivate monthly billing on instance
application_accessexecinstanceId, service_nameReturn initial credentials of applications installed from public image
rebootexecinstanceId, service_name, typeReboot an instance
reinstallexecinstanceId, service_name, imageIdReinstall an instance
rescue_modeexecinstanceId, service_name, rescueEnable or disable rescue mode
resizeexecinstanceId, service_name, flavorIdMigrate your instance to another flavor
resumeexecinstanceId, service_nameResume a suspended instance
shelveexecinstanceId, service_nameShelve an instance. The resources dedicated to the Public Cloud instance are released. The data of the local storage will be stored, the duration of the operation depends on the size of the local disk. The instance can be unshelved at any time. Meanwhile hourly instances will not be billed. The Snapshot Storage used to store the instance's data will be billed.
snapshotexecinstanceId, service_name, snapshotNameSnapshot an instance
startexecinstanceId, service_nameStart an instance
stopexecinstanceId, service_nameStop an instance. The resources dedicated to the Public Cloud instances are still reserved. The instance can be restarted at any time. Meanwhile, the same price is charged for the instance.
unshelveexecinstanceId, service_nameUnshelve an instance. The resources dedicated to the Public Cloud instance are restored. The duration of the operation depends on the size of the local disk. Instance billing will get back to normal and the snapshot used to store the instance's data will be deleted.
vncexecinstanceId, service_nameGet VNC access to your instance

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
instanceIdstringInstance ID
instance_idstringInstance ID (wire: instanceId)
service_namestringThe Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set.
regionstringInstance region

SELECT examples​

Get instance

SELECT
id,
name,
flavor_id,
image_id,
ssh_key_id,
availability_zone,
created,
current_month_outgoing_traffic,
flavor,
image,
ip_addresses,
monthly_billing,
operation_ids,
plan_code,
region,
rescue_password,
ssh_key,
status
FROM ovh.cloud.instances
WHERE instance_id = '{{ instance_id }}' -- required
AND service_name = '{{ service_name }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;

INSERT examples​

Create a new instance

INSERT INTO ovh.cloud.instances (
autobackup,
availability_zone,
flavor_id,
group_id,
image_id,
monthly_billing,
name,
networks,
region,
ssh_key_id,
user_data,
volume_id,
service_name
)
SELECT
'{{ autobackup }}',
'{{ availability_zone }}',
'{{ flavor_id }}' /* required */,
'{{ group_id }}',
'{{ image_id }}',
{{ monthly_billing }},
'{{ name }}' /* required */,
'{{ networks }}',
'{{ region }}' /* required */,
'{{ ssh_key_id }}',
'{{ user_data }}',
'{{ volume_id }}',
'{{ service_name }}'
RETURNING
id,
name,
flavor_id,
image_id,
ssh_key_id,
availability_zone,
created,
current_month_outgoing_traffic,
flavor,
image,
ip_addresses,
monthly_billing,
operation_ids,
plan_code,
region,
rescue_password,
ssh_key,
status
;

UPDATE examples​

Alter an instance

UPDATE ovh.cloud.instances
SET
instance_name = '{{ instance_name }}'
WHERE
instance_id = '{{ instance_id }}' --required
AND service_name = '{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
AND instance_name = '{{ instance_name }}' --required;

DELETE examples​

Delete an instance

DELETE FROM ovh.cloud.instances
WHERE instance_id = '{{ instance_id }}' --required
AND service_name = '{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Create multiple instances

EXEC ovh.cloud.instances.bulk
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"autobackup": "{{ autobackup }}",
"availabilityZone": "{{ availabilityZone }}",
"flavorId": "{{ flavorId }}",
"groupId": "{{ groupId }}",
"imageId": "{{ imageId }}",
"monthlyBilling": {{ monthlyBilling }},
"name": "{{ name }}",
"networks": "{{ networks }}",
"number": {{ number }},
"region": "{{ region }}",
"sshKeyId": "{{ sshKeyId }}",
"userData": "{{ userData }}",
"volumeId": "{{ volumeId }}"
}'
;