> For the complete documentation index, see [llms.txt](https://docs.rumi.systems/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rumi.systems/rumi-cli/commands/cloud/hetzner/run-command.md).

# run-command

Run a shell command on a service instance, over SSH through the bastion.

## Syntax

```bash
rumi cloud hetzner run-command \
  --api-key <token> \
  --network <network> \
  --key-pair <keypair> \
  --service <service> \
  --command <command> \
  [options]
```

## Options

| Option       | Short | Description                                                 | Default  |
| ------------ | ----- | ----------------------------------------------------------- | -------- |
| `--api-key`  | `-k`  | The Hetzner Cloud project API token (or set `HCLOUD_TOKEN`) | Required |
| `--region`   | `-r`  | The Hetzner location the network is in                      | `fsn1`   |
| `--network`  | `-n`  | The name of the network                                     | Required |
| `--key-pair` | `-K`  | The SSH key pair to reach the bastion                       | Required |
| `--service`  | `-s`  | The service instance to run the command on                  | Required |
| `--command`  | `-c`  | The shell command to run                                    | Required |

## Example

```bash
rumi cloud hetzner run-command \
  --api-key $HCLOUD_TOKEN \
  --network my-cloud \
  --key-pair rumi \
  --service myapp \
  --command "ls -la /home/rumi"
```

## See Also

* [run-admin-script](/rumi-cli/commands/cloud/hetzner/run-admin-script.md)
* [list-instances](/rumi-cli/commands/cloud/hetzner/list-instances.md)
* [launch-instance](/rumi-cli/commands/cloud/hetzner/launch-instance.md)
