# Compute

The **Compute** section of the ACE CLI covers everything related to virtual machine infrastructure: creating and managing instances, selecting hardware configurations (flavors), choosing operating system images, and managing SSH key pairs for secure access.

## Resources

| Resource                                              | Command        | Description                                                         |
| ----------------------------------------------------- | -------------- | ------------------------------------------------------------------- |
| [Instances](/knowledge-base/cli/compute/instances.md) | `ace instance` | Virtual machines — create, power manage, resize, snapshot, and more |
| [Flavors](/knowledge-base/cli/compute/flavors.md)     | `ace flavor`   | Hardware configurations (CPU, RAM, disk, GPU) with pricing          |
| [Images](/knowledge-base/cli/compute/images.md)       | `ace image`    | Operating system and application images for booting instances       |
| [Key Pairs](/knowledge-base/cli/compute/key-pairs.md) | `ace key-pair` | SSH key pairs for secure instance access                            |

## Quick Start

Provision a complete instance in four steps:

```bash
# 1. Pick a flavor (hardware size)
ace flavor list --cpu

# 2. Pick an image (operating system)
ace image list --os ubuntu

# 3. Create an SSH key pair
ace key-pair create --name my-key

# 4. Launch the instance
ace instance create \
  --name my-vm \
  --flavor C4i.medium \
  --image Ubuntu-22.04-LTS \
  --network <vpc-id> \
  --security-group <sg-id> \
  --key my-key
```

## Global Flags

All compute commands support these global flags:

| Flag        | Short | Description                                      |
| ----------- | ----- | ------------------------------------------------ |
| `--output`  | `-o`  | Output format: `table` (default), `json`, `yaml` |
| `--verbose` | `-v`  | Enable verbose output                            |
| `--project` |       | Override project ID                              |
| `--region`  |       | Override region                                  |

## Prerequisites

Before using compute commands, you must:

1. **Authenticate** — Run `ace login` to obtain an API token.
2. **Set a project** — Run `ace config set project_id <id>` or use the `--project` flag.
3. **Set a region** — Run `ace config set region <region>` or use the `--region` flag.

Configuration is stored in `~/.ace/config.json`. You can also use environment variables:

| Variable         | Purpose                           |
| ---------------- | --------------------------------- |
| `ACE_TOKEN`      | API authentication token          |
| `ACE_PROJECT_ID` | Default project ID                |
| `ACE_REGION`     | Default region                    |
| `ACE_API_URL`    | Override API endpoint (debugging) |

Precedence: CLI flag > environment variable > config file > hardcoded default.


---

# 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://docs.acecloud.ai/knowledge-base/cli/compute.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.
