Instances CLI reference
See https://docs.openstack.org/nova/2023.1/cli/index.html.
These commands allow you to perform operations related to instance management, such as creating, listing, showing details of, starting, stopping, and deleting instances, as well as managing instance sizes, snapshots, volumes, and floating IPs. The <server_id_or_name>, <flavor_id_or_name>, <image_id_or_name>, <network_id_or_name>, <snapshot_name>, <volume_id_or_name>, and <floating_ip_address> in the commands are placeholders that should be replaced with the actual IDs or names of the resources.
List instances#
openstack server listShow instance details#
openstack server show <server_id_or_name>Create an instance#
Quake AI flavors are boot-from-volume only (disk=0), so you request a root volume at create time with --boot-from-volume ROOT_DISK_GB. The CLI creates a Flash_Premium volume from the image and boots the instance from it.
openstack server create \
--flavor FLAVOR_ID_OR_NAME \
--image IMAGE_ID_OR_NAME \
--boot-from-volume ROOT_DISK_GB \
--network NETWORK_ID_OR_NAME \
--wait \
SERVER_NAMEFLAVOR_ID_OR_NAME: ID or name of the flavor.IMAGE_ID_OR_NAME: ID or name of the image used to seed the root volume.ROOT_DISK_GB: Size of the root volume in GB (minimum 1, and at least the image size).NETWORK_ID_OR_NAME: ID or name of the network.SERVER_NAME: Name of the new instance.
When you boot from a volume created from an image, Quake AI keeps the root volume after you delete the server; it persists and keeps billing until you delete it. To delete the root volume together with the server, create the boot volume through --block-device with delete_on_termination=true instead of --boot-from-volume.
Delete an instance#
openstack server delete <server_id_or_name>Start an instance#
openstack server start <server_id_or_name>Stop an instance#
openstack server stop <server_id_or_name>Reboot an instance#
openstack server reboot --hard <server_id_or_name>- Use
--softfor a soft reboot.
Resize an instance#
openstack server resize --flavor <new_flavor_id_or_name> <server_id_or_name>Confirm resize#
openstack server resize confirm <server_id_or_name>Revert resize#
openstack server resize revert <server_id_or_name>Create an image snapshot of an instance#
openstack server image create --name <snapshot_name> <server_id_or_name>Attach a volume to an instance#
openstack server add volume <server_id_or_name> <volume_id_or_name>Detach a volume from an instance#
openstack server remove volume <server_id_or_name> <volume_id_or_name>Associate a floating IP with an instance#
openstack server add floating ip <server_id_or_name> <floating_ip_address>Disassociate a floating IP from an instance#
openstack server remove floating ip <server_id_or_name> <floating_ip_address>Output columns#
Select specific columns with --column COL1 --column COL2 or change the output format with -f json, -f csv, or -f table (default).
openstack server list#
| Column | Description |
|---|---|
| ID | Instance UUID |
| Name | Instance name |
| Status | Current state (ACTIVE, SHUTOFF, BUILD, ERROR) |
| Networks | Attached networks and IP addresses |
| Image | Source image name or ID |
| Flavor | Flavor name or ID |
openstack server list --long#
| Column | Description |
|---|---|
| ID | Instance UUID |
| Name | Instance name |
| Status | Current state |
| Task State | In-progress operation (spawning, deleting, resizing) or None |
| Power State | Hypervisor power state (Running, Shutdown, No State) |
| Networks | Attached networks and IP addresses |
| Image Name | Source image name |
| Image ID | Source image UUID |
| Flavor | Flavor name or ID |
| Availability Zone | AZ where the instance runs |
| Host | Compute host (visible to admins only) |
| Properties | Instance metadata key-value pairs |