|
| 1 | +--- |
| 2 | +name: cloudamqp-cli |
| 3 | +description: Manage CloudAMQP instances, VPCs, teams, and RabbitMQ/LavinMQ configuration from the command line. Use when the user needs to create, configure, monitor, upgrade, or troubleshoot CloudAMQP message broker instances. |
| 4 | +allowed-tools: Bash(cloudamqp:*) |
| 5 | +--- |
| 6 | + |
| 7 | +# CloudAMQP CLI |
| 8 | + |
| 9 | +## Quick start |
| 10 | + |
| 11 | +```bash |
| 12 | +# list all instances |
| 13 | +cloudamqp instance list |
| 14 | + |
| 15 | +# get instance details (includes connection URL and API key) |
| 16 | +cloudamqp instance get --id 1234 |
| 17 | + |
| 18 | +# create an instance and wait for it to be ready |
| 19 | +cloudamqp instance create --name=my-instance --plan=bunny-1 --region=amazon-web-services::us-east-1 --wait |
| 20 | + |
| 21 | +# restart RabbitMQ on an instance |
| 22 | +cloudamqp instance restart-rabbitmq --id 1234 |
| 23 | + |
| 24 | +# delete an instance |
| 25 | +cloudamqp instance delete --id 1234 |
| 26 | +``` |
| 27 | + |
| 28 | +## Authentication |
| 29 | + |
| 30 | +Before running any commands, check that auth is configured — the CLI won't work without it and can't prompt interactively when run by an agent. |
| 31 | + |
| 32 | +```bash |
| 33 | +# check if already configured |
| 34 | +cat ~/.cloudamqprc 2>/dev/null || echo "not configured" |
| 35 | + |
| 36 | +# if not set up, ask the user for their API key, then write it: |
| 37 | +echo "YOUR_API_KEY" > ~/.cloudamqprc |
| 38 | +chmod 600 ~/.cloudamqprc |
| 39 | +``` |
| 40 | + |
| 41 | +The CLI checks in this order: |
| 42 | + |
| 43 | +1. `CLOUDAMQP_APIKEY` environment variable |
| 44 | +2. `~/.cloudamqprc` file (plain text, just the key) |
| 45 | +3. Interactive prompt (won't work in agent context — use one of the above) |
| 46 | + |
| 47 | +Base URL defaults to `https://customer.cloudamqp.com/api` (override with `CLOUDAMQP_URL`). |
| 48 | + |
| 49 | +## Output |
| 50 | + |
| 51 | +All commands support `-o json` for machine-readable output and `-o table` (default) for human-readable output. Use `-fields` to select specific columns. |
| 52 | + |
| 53 | +## Commands |
| 54 | + |
| 55 | +### Instance lifecycle |
| 56 | + |
| 57 | +```bash |
| 58 | +cloudamqp instance create --name=<name> --plan=<plan> --region=<region> [--tags=<tag>...] [--vpc-id=<id>] [--wait] [--wait-timeout=20m] |
| 59 | +cloudamqp instance list [--details] |
| 60 | +cloudamqp instance get --id <id> |
| 61 | +cloudamqp instance update --id <id> [--name=<name>] [--plan=<plan>] |
| 62 | +cloudamqp instance delete --id <id> [--force] |
| 63 | +cloudamqp instance resize-disk --id <id> --disk-size=<gb> [--allow-downtime] |
| 64 | +``` |
| 65 | + |
| 66 | +### Copy settings between instances |
| 67 | + |
| 68 | +```bash |
| 69 | +cloudamqp instance create --name=staging --plan=bunny-1 --region=amazon-web-services::us-east-1 \ |
| 70 | + --copy-from-id=1234 --copy-settings=metrics,firewall,config,alarms,logs,definitions,plugins --wait |
| 71 | +``` |
| 72 | + |
| 73 | +Only works between dedicated instances (not shared plans). |
| 74 | + |
| 75 | +### Node management |
| 76 | + |
| 77 | +```bash |
| 78 | +cloudamqp instance nodes list --id <id> |
| 79 | +cloudamqp instance nodes versions --id <id> |
| 80 | +``` |
| 81 | + |
| 82 | +### Plugin management |
| 83 | + |
| 84 | +```bash |
| 85 | +cloudamqp instance plugins list --id <id> |
| 86 | +``` |
| 87 | + |
| 88 | +### RabbitMQ configuration |
| 89 | + |
| 90 | +```bash |
| 91 | +cloudamqp instance config list --id <id> |
| 92 | +cloudamqp instance config get --id <id> --key <key> |
| 93 | +cloudamqp instance config set --id <id> --key <key> --value <value> |
| 94 | +``` |
| 95 | + |
| 96 | +### Instance actions |
| 97 | + |
| 98 | +```bash |
| 99 | +# restart |
| 100 | +cloudamqp instance restart-rabbitmq --id <id> [--nodes=node1,node2] |
| 101 | +cloudamqp instance restart-cluster --id <id> |
| 102 | +cloudamqp instance restart-management --id <id> [--nodes=node1,node2] |
| 103 | + |
| 104 | +# start/stop |
| 105 | +cloudamqp instance start --id <id> [--nodes=node1,node2] |
| 106 | +cloudamqp instance stop --id <id> [--nodes=node1,node2] |
| 107 | +cloudamqp instance reboot --id <id> [--nodes=node1,node2] |
| 108 | +cloudamqp instance start-cluster --id <id> |
| 109 | +cloudamqp instance stop-cluster --id <id> |
| 110 | + |
| 111 | +# upgrades (async, return immediately) |
| 112 | +cloudamqp instance upgrade-erlang --id <id> |
| 113 | +cloudamqp instance upgrade-rabbitmq --id <id> --version=<version> |
| 114 | +cloudamqp instance upgrade-all --id <id> |
| 115 | +cloudamqp instance upgrade-versions --id <id> |
| 116 | +``` |
| 117 | + |
| 118 | +### VPC management |
| 119 | + |
| 120 | +```bash |
| 121 | +cloudamqp vpc create --name=<name> --region=<region> --subnet=<cidr> [--tags=<tag>] |
| 122 | +cloudamqp vpc list |
| 123 | +cloudamqp vpc get --id <id> |
| 124 | +cloudamqp vpc update --id <id> --name=<name> |
| 125 | +cloudamqp vpc delete --id <id> |
| 126 | +``` |
| 127 | + |
| 128 | +### Team management |
| 129 | + |
| 130 | +```bash |
| 131 | +cloudamqp team list |
| 132 | +cloudamqp team invite --email=<email> [--role=<role>] [--tags=<tag>] |
| 133 | +cloudamqp team update --user-id=<id> --role=<role> |
| 134 | +cloudamqp team remove --email=<email> |
| 135 | +``` |
| 136 | + |
| 137 | +### Audit log |
| 138 | + |
| 139 | +```bash |
| 140 | +cloudamqp audit [--timestamp=2024-01] |
| 141 | +``` |
| 142 | + |
| 143 | +### API key rotation |
| 144 | + |
| 145 | +```bash |
| 146 | +cloudamqp rotate-key |
| 147 | +``` |
| 148 | + |
| 149 | +## Important behavior |
| 150 | + |
| 151 | +- **Async operations**: Instance creation, disk resizes, and upgrades are async. Use `--wait` on create, or poll with `instance get --id <id>` until `ready: true`. |
| 152 | +- **Destructive commands** (delete, stop) prompt for confirmation. Use `--force` to skip in scripts. |
| 153 | +- **Multiple tags**: Use `--tags` multiple times: `--tags=prod --tags=web`. |
| 154 | +- **Shell completion**: Run `source <(cloudamqp completion zsh)` for tab completion of commands, instance IDs, plans, and regions. |
| 155 | + |
| 156 | +## Plans and regions |
| 157 | + |
| 158 | +Always fetch live data — don't guess plan names or regions: |
| 159 | + |
| 160 | +```bash |
| 161 | +cloudamqp plans [--backend=rabbitmq|lavinmq] |
| 162 | +cloudamqp regions [--provider=amazon-web-services] |
| 163 | +``` |
| 164 | + |
| 165 | +## Specific tasks |
| 166 | + |
| 167 | +* **Scripting and automation** [references/scripting.md](references/scripting.md) |
| 168 | +* **Instance upgrades and maintenance** [references/upgrades.md](references/upgrades.md) |
| 169 | +* **VPC and network setup** [references/vpc-setup.md](references/vpc-setup.md) |
0 commit comments