Skip to content

Instances API reference

See https://docs.openstack.org/api-ref/compute/.

In these methods, {server_id} is the ID of the instance, {attachment_id} is the ID of the volume attachment, and the request bodies contain the necessary information for the specific actions, such as starting, stopping, resizing, and managing snapshots and volumes for instances.

List instances

Bash
GET /servers

Show instance details

Bash
GET /servers/{server_id}

Create an instance

Bash
POST /servers

Request body

JSON
{
   "server": {
      "name": "Instance Name",
         "flavorRef": "Flavor ID or Name",
         "imageRef": "Image ID or Name",
         "networks": [{"uuid": "Network ID or Name"}]
    }
}

Delete an instance

Bash
DELETE /servers/{server_id}

Start an instance

Bash
POST /servers/{server_id}/action

Request body

JSON
{
   "os-start": null
}

Stop an instance

Bash
POST /servers/{server_id}/action

Request body

JSON
{
   "os-stop": null
}

Reboot an instance

Bash
POST /servers/{server_id}/action

Request body

JSON
{
   "reboot": {
      "type": "HARD" or "SOFT"
   }
}

Resize an instance

Bash
POST /servers/{server_id}/action

Request body

JSON
{
   "resize": {
      "flavorRef": "New Flavor ID or Name"
   }
}

Confirm resize

Bash
POST /servers/{server_id}/action

Request body

JSON
{
   "confirmResize": null
}

Revert resize

Bash
POST /servers/{server_id}/action

Request body

JSON
{
   "revertResize": null
}

Create an image snapshot of an instance

Bash
POST /servers/{server_id}/action

Request body

JSON
{
 "createImage": {
   "name": "Snapshot Name"
   }
}

Attach a volume to an instance

Bash
POST /servers/{server_id}/os-volume_attachments

Request body:

JSON
{
   "volumeAttachment": {
     "volumeId": "Volume ID"
   }
}

Detach a volume from an instance

Bash
DELETE /servers/{server_id}/os-volume_attachments/{attachment_id}

Associate a floating IP with an instance

Text Only
POST /servers/{server_id}/action

Request body

JSON
{
 "addFloatingIp": {
   "address": "Floating IP Address"
 }
}

Disassociate a floating IP from an instance

Bash
POST /servers/{server_id}/action

Request body

JSON
{
  "removeFloatingIp": {
     "address": "Floating IP Address"
   }
}