> 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-instances-username-and-tenants-in-openstack-region.md).

# List All Instances, Username, And Tenants in OpenStack Region

## Problem

Obtain a complete list of instance names, tenant name, region name mapped to the corresponding username in an OpenStack region.

## Environment

* Platform9 Managed OpenStack - All Versions
* OpenStack CLI

## Procedure

1. Source the RC file for admin user of your environment.

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

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

{% endtab %}
{% endtabs %}

2. Run the script on **each region.**

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

```none
# Give +x permission to the script before executing.# Run this bash script on each region.echo -e "Instance_Name \t Region \t Username \t \t \t Tenant"for name in $(openstack server list --all -c ID -c Status -f value | awk '{if ($2 != "ERROR") print $1}' )dovm_name=$(openstack server show $name -c name -f value 2> /dev/null)if [[ $vm_name ]];thenUser_name=$(openstack user list | grep `openstack server show $name -c user_id -f value` | awk '{$1=$2=$3="";print $4}' | sed 's/|//g')tenant_name=$(openstack project show -f value -c name $(openstack server show $name -f value -c project_id))echo -e "${vm_name} \t ${OS_REGION_NAME} \t ${User_name} \t ${tenant_name}"fidone
```

{% endtab %}
{% endtabs %}

3. The script output snippet:

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

```none
# ./script.shInstance_Name     Region      Username       Tenant[VM_NAME]         [region]    [username]     [tenant]
```

{% endtab %}
{% endtabs %}

## Additional Information

Refer the OpenStack Documentation for more information on steps to install the [OpenStack CLI](https://docs.platform9.com/openstack/cli-access/cli-overview/) and [command line](https://docs.openstack.org/python-openstackclient/pike/cli/command-objects/server.html#server-list) options.


---

# 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 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-instances-username-and-tenants-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 `automate deployments from our CI pipeline` 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.
