Skip to main content

region_instances

Creates, updates, deletes, gets or lists a region_instances resource.

Overview​

Nameregion_instances
TypeResource
Idovh.cloud.region_instances

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)Instance id
namestringInstance name
flavor_idstring (uuid)Flavor id (wire: flavorId)
image_idstring (uuid)Image id (wire: imageId)
flavor_namestringFlavor name (wire: flavorName)
actionsarrayActions that can be done on the instance
addressesarrayInstance IP addresses
attached_volumesarrayVolumes attached to the instance (wire: attachedVolumes)
availability_zonestringAvailability zone of the instance (wire: availabilityZone)
backupsarrayInstance Backups
flavorobjectInstance flavor
imageobjectInstance image
loginstringUser and address to SSH to your instance
pending_taskbooleanA task is pending for the instance (wire: pendingTask)
pricingsarrayInstance Price
regionstringInstance region
region_typestringType of the region (localzone, region, region-3-az) (wire: regionType)
ssh_keystringInstance SSH key name (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)
task_statestringInstance task state (, block_device_mapping, deleting, image_backup, image_pending_upload, image_snapshot, image_snapshot_pending, image_uploading, migrating, networking, pausing, powering-off, powering-on, reboot_pending, reboot_pending_hard, reboot_started, reboot_started_hard, reboot_starting, rebooting, rebooting_hard, rebooting_pending_hard, rebooting_started_hard, rebuild_block_device_mapping, rebuild_spawning, rebuilding, rescuing, resize_confirming, resize_finish, resize_migrated, resize_migrating, resize_prep, resize_reverting, restoring, resuming, scheduling, shelving, shelving_image_pending_upload, shelving_image_uploading, shelving_offloading, soft_deleting, spawning, starting, stopping, suspending, unknown, unpausing, unrescuing, unshelving, updating_password) (wire: taskState)
volumesarrayInstance volumes

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectinstance_id, region_name, service_namedeleted, with_backups, with_image, with_networks, with_volumesGet a specific instance on a specific region for a public cloud project
listselectregion_name, service_nameList all instances of a specific region for a public cloud project
createinsertregion_name, service_name, billing_period, boot_from, flavor, networkCreate an instance with its associated components (ssh key, private network, floating ip)
abort_snapshotexecinstanceId, regionName, service_nameAbort an instance snapshot creation for a specific instance on a specific region for a public cloud project
associate_floating_ipexecinstanceId, regionName, service_name, floatingIpId, ipAssociate an existing floating IP to an instance on a specific region for a public cloud project
autobackupexecinstanceId, regionName, service_name, cron, rotationCreate an automatic instance backup workflow
floating_ipexecinstanceId, regionName, service_name, ipCreate a floating IP and attach it to an instance on a specific region for a public cloud project
reinstallexecinstanceId, regionName, service_name, imageRegionNameReinstall an instance with a new image
snapshotexecinstanceId, regionName, service_nameCreate an instance snapshot for a specific instance on a specific region for a public cloud project

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"}})
instanceIdstring (uuid)Instance ID
instance_idstring (uuid)Instance ID (wire: instanceId)
regionNamestringRegion name
region_namestringRegion name (wire: regionName)
service_namestringThe Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set.
deletedbooleanReturn instance even if it is deleted
with_backupsbooleanAdd backup information in response (wire: withBackups)
with_imagebooleanAdd image information in response (wire: withImage)
with_networksbooleanAdd network information in response (wire: withNetworks)
with_volumesbooleanAdd volume information in response (wire: withVolumes)

SELECT examples​

Get a specific instance on a specific region for a public cloud project

SELECT
id,
name,
flavor_id,
image_id,
flavor_name,
actions,
addresses,
attached_volumes,
availability_zone,
backups,
flavor,
image,
login,
pending_task,
pricings,
region,
region_type,
ssh_key,
status,
task_state,
volumes
FROM ovh.cloud.region_instances
WHERE instance_id = '{{ instance_id }}' -- required
AND region_name = '{{ region_name }}' -- required
AND service_name = '{{ service_name }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
AND deleted = '{{ deleted }}'
AND with_backups = '{{ with_backups }}'
AND with_image = '{{ with_image }}'
AND with_networks = '{{ with_networks }}'
AND with_volumes = '{{ with_volumes }}'
;

INSERT examples​

Create an instance with its associated components (ssh key, private network, floating ip)

INSERT INTO ovh.cloud.region_instances (
autobackup,
availability_zone,
billing_period,
boot_from,
bulk,
flavor,
group,
name,
network,
ssh_key,
ssh_key_create,
user_data,
volume,
region_name,
service_name
)
SELECT
'{{ autobackup }}',
'{{ availability_zone }}',
'{{ billing_period }}' /* required */,
'{{ boot_from }}' /* required */,
{{ bulk }},
'{{ flavor }}' /* required */,
'{{ group }}',
'{{ name }}',
'{{ network }}' /* required */,
'{{ ssh_key }}',
'{{ ssh_key_create }}',
'{{ user_data }}',
'{{ volume }}',
'{{ region_name }}',
'{{ service_name }}'
RETURNING
id,
resource_id,
action,
completed_at,
created_at,
progress,
regions,
started_at,
status,
sub_operations
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Abort an instance snapshot creation for a specific instance on a specific region for a public cloud project

EXEC ovh.cloud.region_instances.abort_snapshot
@instanceId='{{ instanceId }}' --required,
@regionName='{{ regionName }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;