> For the complete documentation index, see [llms.txt](https://docs.acecloud.ai/knowledge-base/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.acecloud.ai/knowledge-base/cli/compute.md).

# 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 |
| [Spot Instances](/knowledge-base/cli/compute/spot.md) | `ace spot`     | Instances on spare capacity at a lower hourly price, interruptible  |
| [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.
