DreamCompute command-line interface cheat sheet

This article lists several common commands for your reference.

If you have multiple images or volumes with the same name, you will need to use IDs instead of names in the commands below.

Some of the examples below contain a back slash character at the end of each line. This back slash continues the command on the next line. If you like, you can remove this character and put the entire command on a single line.

Images

List images you can access

[user@localhost]$ openstack image list

Delete specified image

[user@localhost]$ openstack image delete IMAGE

Describe a specific image

[user@localhost]$ openstack image show IMAGE

Compute

List instances, check status of instance

[user@localhost]$ openstack server list

List flavors

[user@localhost]$ openstack flavor list

Boot an ephemeral instance

[user@localhost]$ openstack server create --image IMAGE \
--flavor FLAVOR --key-name KEY INSTANCE_NAME

Show details of instance

[user@localhost]$ openstack server show INSTANCE

View console log of instance

[user@localhost]$ openstack console log show INSTANCE

Generate console URL for instance

[user@localhost]$ openstack console url show INSTANCE

Set metadata on an instance

[user@localhost]$ openstack server set --property newmeta='my meta data' INSTANCE

Create and verify details of an instance snapshot

[user@localhost]$ openstack server image create --name IMAGE --wait INSTANCE
[user@localhost]$ openstack image show IMAGE

Pause, suspend, stop, resize, rebuild, reboot an instance

Pause

[user@localhost]$ openstack server pause INSTANCE

Unpause

[user@localhost]$ openstack server unpause INSTANCE

Suspend

[user@localhost]$ openstack server suspend INSTANCE

Unsuspend

[user@localhost]$ openstack server resume INSTANCE

Stop

[user@localhost]$ openstack server stop INSTANCE

Start

[user@localhost]$ openstack server start INSTANCE

Resize

[user@localhost]$ openstack resize --flavor FLAVOR INSTANCE
[user@localhost]$ openstack resize --confirm --wait INSTANCE
[user@localhost]$ openstack resize --revert --wait INSTANCE

Rebuild

[user@localhost]$ openstack server rebuild --wait INSTANCE

Reboot

[user@localhost]$ openstack server reboot --wait --soft INSTANCE
[user@localhost]$ openstack server reboot --hard --wait INSTANCE

Block Storage

Used to manage volumes that attach to instances and volume snapshots.

Create a new and empty 6 GB volume.

[user@localhost]$ openstack volume create --size 6 VOLUME

Boot an instance to attach the new volume to.

[user@localhost]$ openstack server create --image IMAGE \
--flavor FLAVOR --key-name KEY INSTANCE

List volumes and view status of volume.

[user@localhost]$ openstack volume list

Attach volume to an instance after instance is active and volume is available.

[user@localhost]$ openstack server add volume INSTANCE VOLUME

Did this article answer your questions?

Article last updated .