Skip to main content

compute_instance_groups

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

Overview​

Namecompute_instance_groups
TypeResource
Idovh.public_cloud.compute_instance_groups

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)Unique identifier of the instance group, assigned at creation and used to reference it on the GET/DELETE routes
checksumstringChecksum. Computed hash of the current target specification, used for optimistic concurrency control. Because an instance group has no update route, this value never changes after creation.
created_atstring (date-time)Creation date. Timestamp at which the instance group was created, in RFC 3339 format. (wire: createdAt)
current_stateobjectActual state of the instance group as reported by the backend (OpenStack/Nova server group), including its current members. This is read-only and reflects reality, in contrast to targetSpec which is the desired specification supplied on creation. May be null while the group is still being provisioned and no backend state is known yet. (wire: currentState)
current_tasksarrayCurrent tasks. Asynchronous operations currently running against this instance group, for example the initial provisioning or the deletion. Empty or null when no operation is in progress. (wire: currentTasks)
resource_statusstringLifecycle status of the instance group in the system, for example whether it is being created, ready, or being deleted. Reflects readiness of the resource, not the placement policy itself. (CREATING, CREATION_PLANNED, DELETING, ERROR, OUT_OF_SYNC, READY, SUSPENDED, UNKNOWN, UPDATING) (wire: resourceStatus)
target_specobjectTarget specification. Desired specification of the instance group as supplied on creation (name, location and placement policy). Since an instance group cannot be updated, this specification is fixed for the lifetime of the group. Compare it against currentState to see what the backend actually provisioned. (wire: targetSpec)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectinstance_group_id, project_id### Get an instance group<br /><br />Returns a single instance group (placement group), including its scheduling policy and its members.<br /><br />### Immutable by design<br />Instance groups are immutable after creation. There is deliberately no PUT / update route. Neither the placement policy nor the set of members can be changed once the group exists. Membership is fixed at instance creation time: an instance joins a group via its targetSpec.group field when it is created (see the instance POST), and cannot be added to or removed from a group afterward. To change grouping you delete and recreate the affected instances into a different group.
listselectproject_idx_pagination_cursor, x_pagination_size### List instance groups<br /><br />Lists all instance groups (placement groups) in the project, each with the same shape as the GET route (scheduling policy and members).<br /><br />### Immutable by design<br />Instance groups cannot be modified after creation. There is deliberately no PUT / update route, and membership is fixed at instance creation time via the instance's targetSpec.group field. See the GET route for details.
createinsertproject_id, target_spec### Create an instance group<br /><br />Creates a new instance group (placement group). Creation is asynchronous: the group starts in CREATING and becomes READY once the backend has provisioned it.<br /><br />### Placement policy<br />targetSpec.policy chooses how members are scheduled relative to each other:<br />* AFFINITY — members are placed on the same hypervisor.<br />* ANTI_AFFINITY — members are placed on different hypervisors (for high availability).<br /><br />### Immutable, membership set at instance creation<br />The group is immutable once created. There is deliberately no PUT / update route, so the policy can never be changed. The group is created empty: instances are not added here. An instance joins the group only at its own creation time, via its targetSpec.group field (see the instance POST), and membership cannot change afterward (OpenStack/Nova server groups are immutable).
deletedeleteinstance_group_id, project_id### Delete an instance group<br /><br />Deletes an instance group (placement group). Deletion is asynchronous: the resource transitions to DELETING and the backend then removes it.<br /><br />A group is normally removed once it is empty (has no member instances). Because membership is fixed at instance creation time and cannot be edited on an existing group, freeing a group means deleting or recreating its member instances first. Deleting the group tears down only the placement grouping. It does not delete the instances themselves. A delete already in progress is reported as ResourceAlreadyBeingDeleted.

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"}})
instance_group_idstring (uuid)Instance group ID (wire: instanceGroupId)
project_idstringThe Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set.
x_pagination_cursorstringPagination cursor (wire: X-Pagination-Cursor)
x_pagination_sizeintegerPagination size (wire: X-Pagination-Size)

SELECT examples​

Get an instance group<br /><br />Returns a single instance group (placement group), including its scheduling policy and its members.<br /><br />### Immutable by design<br />Instance groups are immutable after creation. There is deliberately no PUT / update route. Neither the placement policy nor the set of members can be changed once the group exists. Membership is fixed at instance creation time: an instance joins a group via its targetSpec.group field when it is created (see the instance POST), and cannot be added to or removed from a group afterward. To change grouping you delete and recreate the affected instances into a different group.​

SELECT
id,
checksum,
created_at,
current_state,
current_tasks,
resource_status,
target_spec
FROM ovh.public_cloud.compute_instance_groups
WHERE instance_group_id = '{{ instance_group_id }}' -- required
AND project_id = '{{ project_id }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;

INSERT examples​

Create an instance group<br /><br />Creates a new instance group (placement group). Creation is asynchronous: the group starts in CREATING and becomes READY once the backend has provisioned it.<br /><br />### Placement policy<br />targetSpec.policy chooses how members are scheduled relative to each other:<br />* AFFINITY — members are placed on the same hypervisor.<br />* ANTI_AFFINITY — members are placed on different hypervisors (for high availability).<br /><br />### Immutable, membership set at instance creation<br />The group is immutable once created. There is deliberately no PUT / update route, so the policy can never be changed. The group is created empty: instances are not added here. An instance joins the group only at its own creation time, via its targetSpec.group field (see the instance POST), and membership cannot change afterward (OpenStack/Nova server groups are immutable).​

INSERT INTO ovh.public_cloud.compute_instance_groups (
target_spec,
project_id
)
SELECT
'{{ target_spec }}' /* required */,
'{{ project_id }}'
RETURNING
id,
checksum,
created_at,
current_state,
current_tasks,
resource_status,
target_spec
;

DELETE examples​

Delete an instance group<br /><br />Deletes an instance group (placement group). Deletion is asynchronous: the resource transitions to DELETING and the backend then removes it.<br /><br />A group is normally removed once it is empty (has no member instances). Because membership is fixed at instance creation time and cannot be edited on an existing group, freeing a group means deleting or recreating its member instances first. Deleting the group tears down only the placement grouping. It does not delete the instances themselves. A delete already in progress is reported as ResourceAlreadyBeingDeleted.​

DELETE FROM ovh.public_cloud.compute_instance_groups
WHERE instance_group_id = '{{ instance_group_id }}' --required
AND project_id = '{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;