Why the Megaport CLI?
Key benefits, use cases, and typical users of the Megaport CLI
The Megaport CLI gives you direct, programmable access to the Megaport Software Defined Networking platform from your terminal. Whether you're provisioning a single port or automating a multi-cloud network across three continents, the CLI is the fastest path from intent to infrastructure.
Key benefits
Speed and efficiency
Provision, update, and decommission network resources in seconds. No portal navigation, no page loads, no clicks through multi-step wizards. A single command can do what would take several minutes in a web interface.
# Provision a cloud router, ready for BGP peering, in one command
megaport-cli mcr buy --name "EU Cloud Hub" --location-id 60 --port-speed 10000 --term 12
Automation-first design
Every command accepts JSON input and produces structured JSON, CSV, or table output. This makes the CLI composable with shell scripts, CI/CD pipelines, and infrastructure-as-code workflows. Store your network configurations as JSON templates in version control and deploy them repeatably across environments.
Multi-cloud in one tool
Connect to AWS Direct Connect, Azure ExpressRoute, Google Cloud Interconnect, Oracle FastConnect, and hundreds of other partners -- all from the same CLI. No need to context-switch between cloud provider consoles to manage your cross-cloud connectivity.
Consistency and repeatability
Scripts don't make typos. JSON templates checked into Git give you version-controlled, peer-reviewed network changes. The same provisioning script that works in staging works in production -- swap a config profile and go.
Flexible deployment
Run the CLI as a native binary on macOS, Linux, or Windows. Pull it as a Docker image for containerised environments. Or try it instantly in the browser via the WebAssembly build -- no installation required.
Full platform coverage
The CLI covers the entire Megaport platform: Ports, VXCs, MCRs, MVEs, IX connections, Locations, Partners, Service Keys, and Users. If you can do it in the portal, you can do it from the command line.
Use cases
Rapid provisioning and day-2 operations
Network engineers use the CLI to provision ports and virtual cross connects in minutes rather than navigating through portal workflows. Update bandwidth, modify VLANs, or decommission services with a single command. This is especially valuable during change windows where time is critical.
Multi-cloud network automation
Organisations connecting to two or more cloud providers use the CLI to script their entire network topology. A Megaport Cloud Router (MCR) acts as the hub, with VXCs fanning out to AWS, Azure, and Google Cloud. The CLI lets you define this topology in JSON and deploy it across regions with a single script.
CI/CD pipeline integration
DevOps teams embed the CLI into GitHub Actions, GitLab CI, or Jenkins pipelines to provision network infrastructure alongside application deployments. Network changes go through the same pull request review process as application code.
Scripted health checks and reporting
Operations teams run scheduled scripts that query resource status, flag non-LIVE services, and export CSV reports of all active infrastructure. This provides visibility without manual portal checks and feeds into existing monitoring dashboards.
Disaster recovery and environment replication
When you need to stand up a duplicate network in a different region, the CLI makes it straightforward. Export your current configuration, adjust the location IDs and names, and re-provision. What would be hours of manual work becomes a parameterised script.
Partner and customer onboarding
Use Service Keys to give partners or customers self-service access to provision VXCs to your ports -- without sharing account credentials. The CLI lets you create, manage, and revoke these keys programmatically.
Demos, training, and proof-of-concept work
The browser-based WebAssembly build lets you run the real CLI in a web page with no local installation. This is ideal for live demos, training sessions, and letting prospects explore the platform hands-on during a sales conversation.
Typical users
Network engineers
The primary users of the CLI. They provision and manage physical ports, virtual cross connects, and cloud routers as part of their daily work. The CLI fits naturally into their terminal-based workflows and gives them precise control over every parameter.
Cloud and platform engineers
Engineers responsible for connecting workloads across AWS, Azure, and Google Cloud. They use the CLI to automate the Megaport side of their cloud networking, often as part of a broader infrastructure-as-code stack alongside Terraform or Pulumi.
DevOps and SRE teams
Teams who manage infrastructure through pipelines rather than portals. They integrate the CLI into CI/CD workflows so that network provisioning is automated, version-controlled, and auditable -- just like application deployments.
Solutions architects
Architects designing multi-cloud or hybrid network topologies use the CLI to quickly prototype and validate connectivity. The browser-based WASM build is particularly useful for walking customers through a solution during a design session.
Technical account managers and sales engineers
Use the CLI (especially the browser demo) to show customers what the Megaport platform can do in real time. Being able to list locations, browse partner configurations, and demonstrate provisioning commands live makes for a compelling, hands-on conversation.
Managed service providers
MSPs managing Megaport infrastructure on behalf of multiple customers. Config profiles let them switch between customer environments quickly, and automation scripts let them apply consistent configurations across their customer base.
How the CLI compares
| Approach | Best for |
|---|---|
| Megaport Portal | Visual exploration, occasional changes, users who prefer a GUI |
| Megaport CLI | Scripting, automation, CI/CD, fast provisioning, terminal-native workflows |
| Megaport Terraform Provider | Declarative infrastructure-as-code, drift detection, state management |
| Megaport API | Custom integrations, building your own tooling on top of the platform |
The CLI and Terraform provider both use the same underlying Go SDK (megaportgo), so they have feature parity with the API. Choose the CLI when you want imperative, interactive control; choose Terraform when you want declarative state management.
What's next?
Ready to get started? Follow the Installation guide to get it running on your machine -- or jump straight to the Browser Demo to try it with zero setup.