Skip to content

Command line (CLI)

mayadyn is Mayadyn’s command line. It speaks the same API as the console and the agents. It prints tables for people, and JSON for scripts and agents.

The CLI is a single program, mayadyn. Put it somewhere on your PATH. A public download is not published yet; ask the Mayadyn team for a copy.

The CLI uses an API token. Create one in the console under API tokens, then:

Terminal window
mayadyn login --url https://console.mayadyn.com --token myd_...

login checks the token, then saves the URL and token to <config dir>/mayadyn/config.json (on Linux ~/.config/mayadyn/config.json; on macOS ~/Library/Application Support/mayadyn/config.json), readable only by you. Always pass --url https://console.mayadyn.com: without it, the CLI points at a local address, not at Mayadyn.

The workspace is the token’s: there is no workspace flag. Use a different token (for example through MAYADYN_TOKEN) for another workspace.

Variable Effect
MAYADYN_URL Overrides the saved server URL.
MAYADYN_TOKEN Overrides the saved token.
Terminal window
MAYADYN_URL=https://console.mayadyn.com MAYADYN_TOKEN=myd_... mayadyn vms list
  • In a terminal, commands print tables or short summaries.
  • With --json (anywhere on the line), or when the output is piped or redirected, commands print JSON. Errors are then printed to standard error as JSON: {"code": …, "message": …, "hint": …}.
  • In text mode, errors print as error: <code>: <message> followed by hint: <hint>.
Code Meaning
0 Success.
1 Error: the request was refused or failed (also when a connection’s check leaves it in error).
2 Usage error: unknown command or missing flag.
3 The operation ran and failed (with --wait, or for ops get / ops wait).

Run mayadyn help for the summary. Flags can come before or after the name or id argument (mayadyn vms stop ID --wait and mayadyn vms stop --wait ID both work).

Terminal window
mayadyn login --url URL --token myd_...
mayadyn whoami

whoami shows the user, the workspace and role, and the token’s scopes and project.

Terminal window
mayadyn catalog

Regions (with city and country), sizes (vCPU, memory, OCI and GCP native values) and images (name, SSH user, providers).

connections can be shortened to conn; list to ls; delete to rm.

Command What it does Scope
mayadyn connections list List connections: name, provider, region, status, auth (key/keyless), account. read
mayadyn connections add --provider oci|gcp --name NAME --region REGION --credentials FILE [--project SLUG_OR_ID] Add a connection and check it. --credentials - reads standard input. admin
mayadyn connections verify NAME Check a connection. Exits 1 if it is left in error. write
mayadyn connections setup NAME Print the trust steps for a keyless connection. read
mayadyn connections credentials NAME --credentials FILE Replace the credentials in place (e.g. key to keyless), then check. admin
mayadyn connections sync NAME [--wait] Refresh the inventory from the cloud (an operation). write
mayadyn connections delete NAME Delete the connection and its stored credentials. Refused while it has machines. destroy + admin
Terminal window
mayadyn connections add --provider gcp --name gcp-dammam --region me-central2 --credentials gcp-keyless.json
mayadyn connections setup gcp-dammam
mayadyn connections verify gcp-dammam

Credential file formats: Connect OCI, Connect GCP.

vms can be shortened to vm; list to ls; delete to rm.

Command What it does Scope
mayadyn vms list [--provider P] [--region R] [--state S] [--connection C] List machines: id, name, provider, region, state, public IP, connection. read
mayadyn vms get ID Show one machine and its ssh command. read
mayadyn vms create --connection C --name N [flags] Create a machine (an operation). write
mayadyn vms start ID [--wait] [--dry-run] [--idempotency-key K] Start. write
mayadyn vms stop ID [--wait] [--dry-run] [--idempotency-key K] Stop. write
mayadyn vms delete ID [--wait] [--dry-run] [--idempotency-key K] Delete the machine and its boot disk. destroy

vms create flags:

Flag Meaning
--connection C Connection name or id. Required.
--name N Machine name. Required.
--region R Default: the connection’s default region.
--size S xsmall, small, medium, large, or a native shape. Default small.
--image I ubuntu-24.04, …, or a native image id. Default ubuntu-24.04.
--ssh-key FILE Public key file. Default ~/.ssh/id_ed25519.pub, id_ecdsa.pub or id_rsa.pub if present. A private key is refused.
--label k=v A label; repeatable.
--dry-run Validate and print the plan only.
--wait Wait until the operation finishes.
--idempotency-key K Retry-safe key. Default: a random key.
Terminal window
mayadyn vms create --connection oci-jeddah --name web-1 --size medium --label team=web --dry-run
mayadyn vms create --connection oci-jeddah --name web-1 --size medium --label team=web --wait
mayadyn vms stop 3f6c… --wait

apps can be shortened to app; list to ls; delete to rm.

Command What it does Scope
mayadyn apps list List apps: name, status, release, URL, region, host state. read
mayadyn apps create --connection C --name N [--region R] [--size S] [--port P] Create an app. Size default small, port default 8080. write
mayadyn apps deploy NAME --image REF [--port P] [--wait] [--dry-run] [--idempotency-key K] Deploy a container image. write
mayadyn apps deploy NAME --git URL [--ref R] [--dockerfile PATH] [--port P] [--wait] [--dry-run] [--idempotency-key K] Build and deploy a git repository. --ref default main. write
mayadyn apps get NAME URL, status, release, region, size, port, host state and health. read
mayadyn apps releases NAME Releases: number, status, source, created, message. read
mayadyn apps logs NAME The container’s recent output. read
mayadyn apps rollback NAME --release N [--wait] Deploy release N again. write
mayadyn apps secrets NAME [--env-file FILE] [--git-token-file FILE --git-host HOST] [--registry SERVER --registry-user U --registry-password-stdin] Save secrets; they apply on the next deploy. write
mayadyn apps delete NAME [--wait] Delete the app, its host machine, data and URL. destroy

--env-file holds KEY=VALUE lines; empty lines and lines starting with # are skipped, and surrounding double quotes on values are removed. It replaces the app’s whole environment.

Terminal window
mayadyn apps create --connection gcp-dammam --name api --port 3000
mayadyn apps secrets api --env-file api.env
mayadyn apps deploy api --git https://github.com/acme/api --ref v1.2.0 --wait
mayadyn apps rollback api --release 1 --wait

ops can also be written operations; list as ls.

Command What it does
mayadyn ops list [--status pending|running|succeeded|failed] The 50 most recent operations.
mayadyn ops get ID One operation, with its error and hint.
mayadyn ops wait ID [--timeout 10m] Wait until it finishes. Default timeout 15 minutes.
Terminal window
mayadyn audit [--action PREFIX] [--limit N]

Shows time, actor ((token) when through a token, system for Mayadyn itself), action, result and target. --action vm. shows only machine actions. --limit defaults to 50; the server accepts up to 500 (a larger value returns 100). Needs read and a token not limited to a project.

Command What it does
mayadyn tokens list Id, name, prefix, scopes, owner, last used, status.
mayadyn tokens create --name N --scopes read,write [--project ID] [--expires-days N] Create a token; prints the secret once. --scopes default read; --expires-days 0 (default) never expires.
mayadyn tokens revoke ID Revoke a token.

All three need admin, except that a token can revoke itself.

  • Pipe to jq: output is JSON automatically when piped. mayadyn vms list | jq -r '.[] | select(.state=="running") | .name'
  • Use --wait and check the exit code: 3 means the operation failed, 1 means the request was refused.
  • Keep an --idempotency-key for creates you may retry.