First Commands
Run your first Megaport CLI commands — list locations, explore resources, and understand output formats
Prerequisites
- Megaport CLI installed
- Credentials configured (env vars or config profile)
With the CLI installed and authenticated, let's explore what you can do. We'll start with commands that work against public data so you can try them without a Megaport account.
Check your setup
# Confirm the CLI is installed and which version
megaport-cli version
# Show your current config (active profile, defaults)
megaport-cli config view
List locations
Locations are the 700+ data centres on the Megaport fabric. This is a great first command — it works without credentials and shows the breadth of the network.
megaport-cli locations list
Example output:
┌──────────────────────────────┬────────────┬──────────────┬────────┬───────────────┐
│ NAME │ COUNTRY │ METRO │ STATUS │ MCR AVAILABLE │
├──────────────────────────────┼────────────┼──────────────┼────────┼───────────────┤
│ NextDC S1 Sydney │ Australia │ Sydney │ ACTIVE │ true │
│ Equinix SY3 Sydney │ Australia │ Sydney │ ACTIVE │ true │
│ NextDC M1 Melbourne │ Australia │ Melbourne │ ACTIVE │ true │
│ Equinix ME1 Melbourne │ Australia │ Melbourne │ ACTIVE │ true │
│ NextDC B1 Brisbane │ Australia │ Brisbane │ ACTIVE │ false │
└──────────────────────────────┴────────────┴──────────────┴────────┴───────────────┘
Filter locations
# By country
megaport-cli locations list --country AU
# By metro area
megaport-cli locations list --metro Singapore
# Only locations that support MCR (Cloud Router)
megaport-cli locations list --mcr-available
# By data centre name
megaport-cli locations list --name "Equinix"
# Fuzzy search — quick way to find a location
megaport-cli locations search "Equinix Sydney"
Output formats
Every list and get command supports four output formats via the --output flag (short: -o).
Table (default)
Human-readable — great for interactive use:
megaport-cli locations list --metro Sydney --output table
JSON
Structured output — ideal for scripting, jq filtering, and automation:
megaport-cli locations list --metro Sydney --output json
[
{
"id": 3,
"name": "NextDC S1 Sydney",
"country": "Australia",
"metro": "Sydney",
"market": "AU",
"status": "ACTIVE",
"mcr_available": true,
"mve_available": true
}
]
CSV
Spreadsheet-friendly — pipe into files or tools:
megaport-cli locations list --output csv > locations.csv
XML
megaport-cli locations list --output xml
Set a default format
If you prefer JSON for all commands:
megaport-cli config set-default output json
Explore your resources
These commands require authentication (active credentials in your profile or env vars).
Ports
# List all your ports
megaport-cli ports list
# Filter by name
megaport-cli ports list --port-name "Sydney"
# Filter by location
megaport-cli ports list --location-id 3
# Include cancelled/decommissioned ports
megaport-cli ports list --include-inactive
# Get full details on a specific port
megaport-cli ports get <PORT-UID>
VXCs
# List all Virtual Cross Connects
megaport-cli vxc list
MCRs
# List all Megaport Cloud Routers
megaport-cli mcr list
# Get details on a specific MCR
megaport-cli mcr get <MCR-UID>
Dashboard
Get an overview of all your resources at a glance:
# Combined status dashboard — shows all ports, MCRs, MVEs, VXCs, and IXs
megaport-cli status
# Or list individual resource types
megaport-cli ports list
megaport-cli vxc list
megaport-cli mcr list
# See resource relationships as a tree
megaport-cli topology
Get details on a resource
# Port details
megaport-cli ports get abc-1234-5678-def
# Location details
megaport-cli locations get 3
# MCR details
megaport-cli mcr get abc-1234-5678-def
Getting help
Built-in help is always available for any command or subcommand:
# Top-level help — lists all command groups
megaport-cli --help
# Help for a command group
megaport-cli ports --help
# Help for a specific subcommand — shows all flags
megaport-cli ports buy --help
megaport-cli vxc buy --interactive
megaport-cli locations list --help
Try it live in your browser
All of these commands work in the browser-based terminal — no install needed. Enter your API credentials and start running commands right now.
What's next?
You've got the fundamentals. Pick a path:
- Core Concepts — understand Ports, VXCs, MCRs, and MVEs in depth
- Port Lifecycle tutorial — create your first Port step by step
- Connect to AWS — provision a Direct Connect VXC