> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pmo/how-to/list-all-vms-in-openstack-region.md).

# List All VMs in OpenStack Region

## Problem

The need exists to obtain a complete list of all Virtual Machines running in an OpenStack region.

## Environment

* Platform9 Managed OpenStack - All Versions
* OpenStack Unified CLI

## Procedure

1. Source the admin RC file for your environment.

{% tabs %}
{% tab title="None" %}

```none
$ source [your_rc_file].rc
```

{% endtab %}
{% endtabs %}

2. Get a list of all VMs across all projects and users and copy it to a text file.

{% tabs %}
{% tab title="None" %}

```none
$ openstack server list --all-projects > all_vms
```

{% endtab %}
{% endtabs %}

3. This list can be pretty long if your environment has many users and only one region. In that case, you can filter the output using various parameters. For eg., you can use this command to get a list of only those instances which are in an 'Active' state.

{% tabs %}
{% tab title="None" %}

```none
$ openstack server list --all-projects --status ACTIVE
```

{% endtab %}
{% endtabs %}

4. Additional filters are available and can be explored by using the **'-h'** flag on the server list command.

{% tabs %}
{% tab title="None" %}

```none
$ openstack server list -h usage: openstack server list [-h] [-f {csv,json,table,value,yaml}] [-c COLUMN]  [--max-width [integer]] [--fit-width]  [--print-empty] [--noindent]  [--quote {all,minimal,none,nonnumeric}]  [--sort-column SORT_COLUMN]  [--reservation-id [reservation-id]]  [--ip [ip-address-regex]]  [--ip6 [ip-address-regex]] [--name [name-regex]]  [--instance-name [server-name]]  [--status [status]] [--flavor [flavor]]  [--image [image]] [--host [hostname]]  [--all-projects] [--project [project]]  [--project-domain [project-domain]]  [--user [user]] [--user-domain [user-domain]]  [--long] [-n | --name-lookup-one-by-one]  [--marker [server]] [--limit [num-servers]]  [--deleted] [--changes-since [changes-since]]
```

{% endtab %}
{% endtabs %}

5. The output can be printed out in various data formats depending on how you plan to consume this list.

{% tabs %}
{% tab title="None" %}

```none
$ openstack server list -h usage: openstack server list [-h] [-f {csv,json,table,value,yaml}]
```

{% endtab %}
{% endtabs %}

6. The command can also be used to output a single column if all the headers not needed. For eg., the following command will output only a list VM by their UUIDs

{% tabs %}
{% tab title="None" %}

```none
$ openstack server list --all-project -c ID
```

{% endtab %}
{% endtabs %}

## Additional Information

* [Installing the OpenStack CLI](https://docs.platform9.com/openstack/cli-access/cli-overview/)
* [OpenStack Documentation](https://docs.openstack.org/python-openstackclient/pike/cli/command-objects/server.html#server-list)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://platform9.com/kb/pmo/how-to/list-all-vms-in-openstack-region.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
