> 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://platform9.com/kb/pmo/how-to/list-all-instances-username-and-tenants-in-openstack-region.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
