# get\_compute\_ec2

Retrieve all AWS EC2 instances from Polaris

```python
def get_compute_ec2(self, object_id=None):
```

## Arguments

| Name       | Type | Description                      | Choices |
| ---------- | ---- | -------------------------------- | ------- |
| object\_id | str  | A specific Object ID to retrieve |         |

## Returns

| Type | Return Value                                                                             |
| ---- | ---------------------------------------------------------------------------------------- |
| list | List of all the AWS EC2 instances or the specific instance if the `object_id` is passed. |

## Example

```python
from rubrik_polaris import PolarisClient


domain = 'my-company'
username = 'john.doe@example.com'
password = 's3cr3tP_a55w0R)'


client = PolarisClient(domain, username, password, insecure=True)

# Search for a set of objects and get their details
for i in client.get_compute_object_ids_ec2(region = 'US_WEST_2'):
    print(client.get_compute_ec2(i))
```


---

# Agent Instructions: 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:

```
GET https://rubrik.gitbook.io/rubrik-sdk-for-python/beta/rubrik_polaris/compute/get_compute_ec2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
