Skip to content

CLI Cheat Sheet

Quick-reference one-pager for the most common Megaport CLI commands

Copy any command below. For full details, see the Command Reference.


Authentication

$export MEGAPORT_ACCESS_KEY=your_key MEGAPORT_SECRET_KEY=your_secret MEGAPORT_ENVIRONMENT=staging

Set credentials via environment variables (simplest approach)

$megaport-cli config create-profile staging --access-key $KEY --secret-key $SECRET --environment staging

Create a named config profile for reuse

$megaport-cli config use-profile staging

Switch to a saved profile


Ports

$megaport-cli ports list

List all ports in your account

$megaport-cli ports get PORT_UID

Show details of a specific port

$megaport-cli ports buy --interactive

Buy a port with guided prompts

$megaport-cli ports delete PORT_UID

Soft-delete a port (can be restored within cancellation window)


VXCs (Virtual Cross Connects)

$megaport-cli vxc list

List all VXCs

$megaport-cli vxc buy --interactive

Buy a VXC with guided prompts


MCRs (Megaport Cloud Routers)

$megaport-cli mcr list

List all MCRs

$megaport-cli mcr buy --interactive

Buy an MCR with guided prompts


MVEs (Megaport Virtual Edges)

$megaport-cli mve list

List all MVEs


Locations

$megaport-cli locations list

List all 800+ data centre locations

$megaport-cli locations list --metro Sydney

Filter locations by metro area

$megaport-cli locations list --mcr-available

Show only locations where MCR is available


Partners

$megaport-cli partners list

List all cloud partner ports

$megaport-cli partners list --company-name "Amazon Web Services"

Filter to a specific cloud provider


Service Keys

$megaport-cli servicekeys list

List all service keys


Output Formats

$megaport-cli ports list --output json

JSON output for scripting

$megaport-cli ports list --output csv

CSV output for spreadsheets

$megaport-cli ports list --output json | jq '.[].name'

Pipe JSON to jq for filtering


Command Aliases

Most subcommands have short aliases for faster typing:

Full commandAliasExample
listlsmegaport-cli ports ls
getshowmegaport-cli ports show PORT_UID
statusstmegaport-cli ports st PORT_UID
deletermmegaport-cli ports rm PORT_UID

Status & Diagnostics

$megaport-cli status

Full infrastructure dashboard — all resource types

$megaport-cli version

Show CLI version