Port Lifecycle
Walk through the complete lifecycle of a Megaport port — provision, inspect, update, lock, tag, and decommission
Prerequisites
- Megaport CLI installed and authenticated
This tutorial walks through every stage of a Megaport Port — from finding a location to permanent decommission. By the end you'll know every port operation and when to use each one.
Lifecycle overview
Step 1 — Find a location
Ports are provisioned at specific data centres. Start by finding one near you or your cloud provider.
# Browse all locations
megaport-cli locations list
# Filter by metro area
megaport-cli locations list --metro Sydney
# Only locations with MCR support (if you plan to add a cloud router later)
megaport-cli locations list --metro Sydney --mcr-available
Example output:
NAME COUNTRY METRO STATUS MCR AVAILABLE
NextDC S1 Sydney Australia Sydney ACTIVE true
Equinix SY3 Sydney Australia Sydney ACTIVE true
Equinix SY4 Sydney Australia Sydney ACTIVE false
Global Switch Sydney West Australia Sydney ACTIVE true
NEXTDC S2 Sydney Australia Sydney ACTIVE true
Note the ID by running with --output json to get the numeric location ID you'll need for --location-id:
megaport-cli locations list --metro Sydney --output json | jq '.[] | {id, name}'
Step 2 — Provision a port
The same port can be purchased three ways. Choose the mode that fits your workflow.
Interactive
megaport-cli ports buy --interactive
The CLI prompts for each parameter:
? Port name: Tutorial Port SYD-01
? Location ID (run 'locations list' to find IDs): 3
? Port speed [1000, 10000, 100000]: 10000
? Contract term in months [1, 12, 24, 36]: 12
? Marketplace visibility (make port visible to other Megaport customers)? No
Summary:
Name: Tutorial Port SYD-01
Location: 3 (NextDC S1 Sydney)
Speed: 10000 Mbps (10G)
Term: 12 months
Marketplace visible: false
? Confirm purchase? Yes
Port created: abc-1234-5678-def
Status: CONFIGURED
Flags
megaport-cli ports buy \
--name "Tutorial Port SYD-01" \
--location-id 3 \
--port-speed 10000 \
--term 12 \
--marketplace-visibility false
JSON
megaport-cli ports buy --json '{
"name": "Tutorial Port SYD-01",
"locationId": 3,
"portSpeed": 10000,
"term": 12,
"marketPlaceVisibility": false
}'
Or from a file:
megaport-cli ports buy --json-file ./port-config.json
Parameter reference
| Parameter | Values | Notes |
|---|---|---|
--name | String, 1–64 chars | Shown in portal and invoices |
--port-speed | 1000, 10000, 100000 Mbps | 1G, 10G, or 100G |
--term | 1, 12, 24, 36 months | Longer terms = lower rates |
--marketplace-visibility | true / false | false = private, not listed to other Megaport customers |
--diversity-zone | e.g. blue, red | For redundant port pairs at the same location |
--cost-centre | String | Billing label for cost allocation |
Save your Port UID
The output includes a Port UID (e.g. abc-1234-5678-def). Save it — every subsequent command uses it as the first argument or flag.
Step 3 — Check status
# Full details
megaport-cli ports get <PORT-UID>
# Check provisioning status
megaport-cli ports status <PORT-UID>
# Watch status in real-time until it goes LIVE
megaport-cli ports status <PORT-UID> --watch
# See it in your list
megaport-cli ports list
megaport-cli ports list --port-name "Tutorial"
The port starts as CONFIGURED while Megaport provisions it on the fabric. It transitions to LIVE automatically — typically within a few minutes for a new port. Use --watch to auto-refresh until the transition completes.
Step 4 — Update the port
You can update a port's name, marketplace visibility, cost centre, or extend its term without any downtime.
# Rename
megaport-cli ports update <PORT-UID> --name "Production Port SYD-01"
# Make it visible in the Megaport Marketplace
megaport-cli ports update <PORT-UID> --marketplace-visibility true
# Add a cost centre for billing reports
megaport-cli ports update <PORT-UID> --cost-centre "NET-001"
Step 5 — Lock and unlock
Locking a port prevents accidental deletion. Locked ports cannot be deleted until unlocked.
# Lock — protects against accidental deletion
megaport-cli ports lock <PORT-UID>
# Unlock — allow changes again
megaport-cli ports unlock <PORT-UID>
Lock production ports
Lock any port carrying live traffic. It takes one extra step to unlock before deleting, giving you a safety check against accidental delete commands.
Step 6 — Add resource tags
Tags are key-value pairs for organisation, cost allocation, and automation filtering.
# Add tags (replaces all existing tags)
megaport-cli ports update-tags <PORT-UID> \
--json '{"env":"production","team":"networking","project":"cloud-connect"}'
# View current tags
megaport-cli ports list-tags <PORT-UID>
Tags are replaced, not merged
update-tags replaces the entire tag set. If you want to add a tag without losing existing ones, read the current tags first and include them all in your update.
Step 7 — Delete and restore
Soft delete (default)
The standard delete schedules removal at end of the current billing period. Traffic is not disrupted immediately.
megaport-cli ports delete <PORT-UID>
Restore within the window
If you deleted by mistake, you can restore before the billing period ends:
megaport-cli ports restore <PORT-UID>
Safe delete — check for attached VXCs first
Use --safe-delete if you want the command to fail rather than delete a port that still has VXCs:
megaport-cli ports delete <PORT-UID> --safe-delete
# Error: port has 2 attached VXC(s) — delete them first or omit --safe-delete
Immediate deletion
megaport-cli ports delete <PORT-UID> --now
--now is irreversible
--now permanently deletes the port and all attached VXCs immediately. There is no restore window. Use --safe-delete first if you're unsure whether VXCs are attached.
What's next?
Now that you can manage a port, connect it to something:
- Connect to AWS — create a VXC to AWS Direct Connect
- Connect to Azure — create a VXC to Azure ExpressRoute
- Resource Types — understand what else you can connect to your port
For Sales demos
Five minutes from command to live port — no data centre visits, no hardware lead times, no cross-connect orders. Run this in the browser terminal to show customers exactly how fast Megaport provisions infrastructure.