Read commands (list, get, plans, regions) support -o json. All values come out as strings.
# get connection URL for an instance (masked; add --show-url for full URL)
cloudamqp instance get --id <id> -o json | jq -r '.url'
# find instances that aren't ready (requires --details; ready is "Yes"/"No" string)
cloudamqp instance list --details -o json | jq -r '.[] | select(.ready == "No") | "\(.id) \(.name)"'
# get IDs matching a tag (requires --details; tags is a comma-joined string)
cloudamqp instance list --details -o json | jq -r '.[] | select(.tags | split(",") | map(ltrimstr(" ")) | contains(["staging"])) | .id'instance create prints a human-readable prefix before the JSON, so pipe through tail -n +2:
# fetch a valid plan and region first
PLAN=$(cloudamqp plans --backend=rabbitmq -o json | jq -r '.[0].name')
REGION=$(cloudamqp regions -o json | jq -r '.[0].id')
RESULT=$(cloudamqp instance create --name=temp --plan="$PLAN" --region="$REGION" | tail -n +2)
INSTANCE_ID=$(echo "$RESULT" | jq -r '.id')Prefer the built-in flag:
cloudamqp instance create --name=my-instance --plan=<plan> --region=<region> --wait --wait-timeout=20mOr poll manually:
while true; do
STATUS=$(cloudamqp instance get --id "$INSTANCE_ID" -o json | jq -r '.ready')
[ "$STATUS" = "Yes" ] && break
sleep 30
donecloudamqp instance delete --id <id> --force
cloudamqp vpc delete --id <id> --force# restart all instances tagged "staging" (--details required for tags field)
for ID in $(cloudamqp instance list --details -o json | jq -r '.[] | select(.tags | split(",") | map(ltrimstr(" ")) | contains(["staging"])) | .id'); do
cloudamqp instance restart-rabbitmq --id "$ID"
donecloudamqp instance create \
--name=staging-copy \
--plan=<plan> \
--region=<region> \
--copy-from-id=<source-id> \
--copy-settings=alarms,metrics,logs,firewall,config,definitions,plugins \
--waitOnly works between dedicated instances (not shared plans).