instances
Creates, updates, deletes, gets or lists an instances resource.
Overview​
| Name | instances |
| Type | Resource |
| Id | ovh.cloud.instances |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
id | string | Instance id |
name | string | Instance name |
flavor_id | string | Instance flavor id (wire: flavorId) |
image_id | string | Instance image id (wire: imageId) |
ssh_key_id | string | Instance ssh key id (wire: sshKeyId) |
availability_zone | string | Availability zone of the instance (wire: availabilityZone) |
created | string (date-time) | Instance creation date |
current_month_outgoing_traffic | integer | Instance outgoing network traffic for the current month (in bytes) (wire: currentMonthOutgoingTraffic) |
flavor | object | Instance flavor |
image | object | Instance image |
ip_addresses | array | Instance IP addresses (wire: ipAddresses) |
monthly_billing | object | Instance monthly billing status (wire: monthlyBilling) |
operation_ids | array | Ids of pending public cloud operations (wire: operationIds) |
plan_code | string | Order plan code (wire: planCode) |
region | string | Instance id |
rescue_password | string (password) | Rescue password if instance is in RESCUE status (wire: rescuePassword) |
ssh_key | object | Instance SSH key (wire: sshKey) |
status | string | Instance 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) |
Instance
| Name | Datatype | Description |
|---|---|---|
id | string | Instance id |
name | string | Instance name |
flavor_id | string | Instance flavor id (wire: flavorId) |
image_id | string | Instance image id (wire: imageId) |
ssh_key_id | string | Instance ssh key id (wire: sshKeyId) |
availability_zone | string | Availability zone of the instance (wire: availabilityZone) |
created | string (date-time) | Instance creation date |
current_month_outgoing_traffic | integer | Instance outgoing network traffic for the current month (in bytes) (wire: currentMonthOutgoingTraffic) |
flavor | object | Instance flavor |
image | object | Instance image |
ip_addresses | array | Instance IP addresses (wire: ipAddresses) |
monthly_billing | object | Instance monthly billing status (wire: monthlyBilling) |
operation_ids | array | Ids of pending public cloud operations (wire: operationIds) |
plan_code | string | Order plan code (wire: planCode) |
region | string | Instance id |
rescue_password | string (password) | Rescue password if instance is in RESCUE status (wire: rescuePassword) |
ssh_key | object | Instance SSH key (wire: sshKey) |
status | string | Instance 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | instance_id, service_name | Get instance | |
list | select | service_name | region | Get instance |
create | insert | service_name, flavor_id, name, region | Create a new instance | |
update | update | instance_id, service_name, instance_name | Alter an instance | |
delete | delete | instance_id, service_name | Delete an instance | |
bulk | exec | service_name, flavorId, name, number, region | Create multiple instances | |
active_monthly_billing | exec | instanceId, service_name | Activate monthly billing on instance | |
application_access | exec | instanceId, service_name | Return initial credentials of applications installed from public image | |
reboot | exec | instanceId, service_name, type | Reboot an instance | |
reinstall | exec | instanceId, service_name, imageId | Reinstall an instance | |
rescue_mode | exec | instanceId, service_name, rescue | Enable or disable rescue mode | |
resize | exec | instanceId, service_name, flavorId | Migrate your instance to another flavor | |
resume | exec | instanceId, service_name | Resume a suspended instance | |
shelve | exec | instanceId, service_name | Shelve 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. | |
snapshot | exec | instanceId, service_name, snapshotName | Snapshot an instance | |
start | exec | instanceId, service_name | Start an instance | |
stop | exec | instanceId, service_name | Stop 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. | |
unshelve | exec | instanceId, service_name | Unshelve 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. | |
vnc | exec | instanceId, service_name | Get 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.
| Name | Datatype | Description |
|---|---|---|
api_host | string | The 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"}}) |
instanceId | string | Instance ID |
instance_id | string | Instance ID (wire: instanceId) |
service_name | string | The Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set. |
region | string | Instance region |
SELECT examples​
- get
- list
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
;
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 service_name = '{{ service_name }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
AND region = '{{ region }}'
;
INSERT examples​
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: instances
props:
- name: service_name
value: "{{ service_name }}"
description: Required parameter for the instances resource.
- name: autobackup
description: |
Create an autobackup workflow after instance start up
value:
cron: "{{ cron }}"
rotation: {{ rotation }}
- name: availability_zone
value: "{{ availability_zone }}"
description: |
Availability zone to create the instance on
- name: flavor_id
value: "{{ flavor_id }}"
description: |
Instance flavor id
- name: group_id
value: "{{ group_id }}"
description: |
Start instance in group
- name: image_id
value: "{{ image_id }}"
description: |
Instance image id
- name: monthly_billing
value: {{ monthly_billing }}
description: |
Active monthly billing
- name: name
value: "{{ name }}"
description: |
Instance name
- name: networks
description: |
Create network interfaces
value:
- ip: "{{ ip }}"
networkId: "{{ networkId }}"
- name: region
value: "{{ region }}"
description: |
Instance region
- name: ssh_key_id
value: "{{ ssh_key_id }}"
description: |
SSH keypair id
- name: user_data
value: "{{ user_data }}"
description: |
Configuration information or scripts to use upon launch
- name: volume_id
value: "{{ volume_id }}"
description: |
Specify a volume id to boot from it
UPDATE examples​
- update
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
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.
- bulk
- active_monthly_billing
- application_access
- reboot
- reinstall
- rescue_mode
- resize
- resume
- shelve
- snapshot
- start
- stop
- unshelve
- vnc
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 }}"
}'
;
Activate monthly billing on instance
EXEC ovh.cloud.instances.active_monthly_billing
@instanceId='{{ instanceId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;
Return initial credentials of applications installed from public image
EXEC ovh.cloud.instances.application_access
@instanceId='{{ instanceId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;
Reboot an instance
EXEC ovh.cloud.instances.reboot
@instanceId='{{ instanceId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"type": "{{ type }}"
}'
;
Reinstall an instance
EXEC ovh.cloud.instances.reinstall
@instanceId='{{ instanceId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"imageId": "{{ imageId }}"
}'
;
Enable or disable rescue mode
EXEC ovh.cloud.instances.rescue_mode
@instanceId='{{ instanceId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"imageId": "{{ imageId }}",
"rescue": {{ rescue }}
}'
;
Migrate your instance to another flavor
EXEC ovh.cloud.instances.resize
@instanceId='{{ instanceId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"flavorId": "{{ flavorId }}"
}'
;
Resume a suspended instance
EXEC ovh.cloud.instances.resume
@instanceId='{{ instanceId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;
Shelve 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.
EXEC ovh.cloud.instances.shelve
@instanceId='{{ instanceId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;
Snapshot an instance
EXEC ovh.cloud.instances.snapshot
@instanceId='{{ instanceId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"snapshotName": "{{ snapshotName }}"
}'
;
Start an instance
EXEC ovh.cloud.instances.start
@instanceId='{{ instanceId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;
Stop 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.
EXEC ovh.cloud.instances.stop
@instanceId='{{ instanceId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;
Unshelve 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.
EXEC ovh.cloud.instances.unshelve
@instanceId='{{ instanceId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;
Get VNC access to your instance
EXEC ovh.cloud.instances.vnc
@instanceId='{{ instanceId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;