linux · openstack

openstack: deleting several VMs automatically

Instead of deleting several VMs using Openstack UI you can execute it by the command line, making the process semi-automated.

The first step is to install the openstack command on your Linux distribution. You can learn more about it here.

Once the setup is done, you can use the following command to filter and deleted several servers at once:

openstack server list -c ID -c Name -f value | grep <SOME_PATTERN_TO_FILTER_BY_NAME> | sed 's/ / /' | awk '{print $1}' | xargs -n1 openstack server delete

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s