Skip to main content
This topic describes the API procedure to create a Virtual Cross Connect (VXC) on a Megaport NAT Gateway (NAT Gateway). The example shows how to create a VXC to an AWS cloud service and configure BGP peering on the NAT Gateway A-End.

Prerequisites

Before you begin, obtain a valid access token. For more information, see Creating an API Key. You also need a provisioned NAT Gateway. For more information, see Creating a NAT Gateway with the API.

Creating a VXC between a NAT Gateway and AWS

This example creates an AWS private VXC. The steps include how to:
  • get the NAT Gateway product ID
  • find the AWS location ID
  • configure a BGP connection on the NAT Gateway A-End
  • validate and order the VXC
To create the VXC, you need the productUid for the NAT Gateway. To get the productUid for the NAT Gateway
  1. Send a GET request to retrieve your NAT Gateway products.
  2. From the response, locate the productUid for the NAT Gateway you want to connect. This example uses this value: abc12345-1234-1234-1234-abc123456789
To find the locationId where AWS is available
  1. Get the list of all interfaces Megaport has with Cloud Service Providers (CSPs).
    You can filter the response to show only interfaces from a specific cloud provider using the connectType query parameter, such as:
  2. Search the response for a site in your preferred region. For this example, select a US West site with "locationId": 57.
    To order the VXC, you need the following IDs from the response:
    • locationId - The ID of the location.
    • productUid - The port to connect to.
    • companyUid - The ID of the Cloud Service Provider (CSP).
To create the VXC The A-End partnerConfig uses connectType: "VROUTER", and includes IP addresses and BGP connections for the NAT Gateway interface. The B-End specifies the AWS connection details. The B-End configuration needs the following IDs from the previous step:
  • locationId — The locationId of the location
  • productUid — The productUid of the port at the location
  • OwnerUid — The companyUid of the CSP
In the request Body, you need to specify the UID of the NAT Gateway (productUid).
  1. Create a request with this URL:
  2. Create the request Body with the configuration details.
To test your request before you order, use POST {baseUrl}/v3/networkdesign/validate.
Example Request Body
If the request is successful, the response includes the details of the created VXC.

NAT Gateway pools

You can configure NAT Gateway pools to control how the NAT Gateway translates outgoing traffic to public IP addresses. Each pool contains IP address ranges that are used as the source addresses for translated traffic.
NAT Gateway pools are only required on VXCs connecting to resources outside your private network, such as CSPs or the internet. VXCs connecting resources inside your network to the NAT Gateway do not require pool configuration.
You can configure pools on a VXC when you create it or after it is provisioned. To configure pools using the Portal, see Using NAT Gateway Pools.

BGP connections

You can configure multiple BGP connections per interface by adding a bgpConnections array to the interfaces array of the A-End partner configuration:

Bidirectional Forwarding Detection (BFD)

The bfd configuration object applies to all BGP connections on the interface that have bfdEnabled = true. When you enable BFD, the system automatically applies these fixed settings:
  • : 300 milliseconds
  • : 300 milliseconds
  • : 3
These settings apply to all BGP connections on the VXC where BFD is enabled.

Static routes

You can configure static routes per interface by adding an ipRoutes array to the interfaces array of the A-End partner configuration:

Prefix lists

Prefix lists are named sets of IP prefixes that you can apply to BGP connections to filter route advertisements. You reference a prefix list by its id in the BGP connection parameters importWhitelist, importBlacklist, exportWhitelist, and exportBlacklist.
For more information, see BGP connections.
For more information about prefix filtering, see Megaport NAT Gateway BGP Prefix Filtering. The tasks in this section include how to:
  • get a summary of all prefix lists
  • create a prefix list
  • get a prefix list
  • update a prefix list
  • delete a prefix list
To get a summary of all prefix lists Send a GET request to retrieve all prefix lists on a NAT Gateway. Endpoint
Path Parameters Example Request
Response The response includes the ID, description, and address family for each prefix list:
To create a prefix list Send a POST request to the prefix lists endpoint with the configuration as the request Body. Endpoint
Path Parameters Example Request Body
Response A successful response (HTTP 200) includes the created prefix list with its assigned id.
To get a prefix list Send a GET request. Replace {prefixListId} with the ID from the prefix list summary. Endpoint
Path Parameters Example Request
Response A successful response (HTTP 200) returns the prefix list details.
To update a prefix list To replace all existing entries in the list, send a PUT request with the full prefix list configuration in the request Body. Endpoint
Path Parameters Example Request Body
Response A successful response (HTTP 200) returns the updated prefix list.
To delete a prefix list Send a DELETE request to the prefix lists endpoint. Endpoint
Path Parameters Example Request
Response A successful response (HTTP 200) confirms the prefix list was deleted.

Packet filters

Packet filters control traffic flow to and from the NAT Gateway by defining ordered rules that match packets based on protocol, source and destination addresses, and ports. Entries are evaluated in order, and the first matching rule determines the action.
For more information, see Using Packet Filters with NAT Gateway.
The tasks in this section include how to:
  • get a summary of all packet filters
  • create a packet filter
  • get a packet filter
  • update a packet filter
  • delete a packet filter
To get a summary of all packet filters Send a GET request to retrieve all packet filters on a NAT Gateway. Endpoint
Path Parameters Example Request
Response The response includes the ID and description for each packet filter:
To create a packet filter Send a POST request to the packet filters endpoint with the configuration as the request Body. Endpoint
Path Parameters Example Request Body
Response A successful response (HTTP 200) includes the created packet filter with its assigned id.
To get a packet filter Send a GET request. Replace {packetFilterId} with the ID from the packet filter summary. Endpoint
Path Parameters Example Request
Response A successful response (HTTP 200) returns the packet filter details.
To update a packet filter To replace all existing entries in the configuration, send a PUT request with the full packet filter configuration in the request Body. Endpoint
Path Parameters Example Request Body
Response A successful response (HTTP 200) returns the updated packet filter.
To delete a packet filter Send a DELETE request to the packet filters endpoint. Endpoint
Path Parameters Example Request
Response A successful response (HTTP 200) confirms the packet filter was deleted.

Autoconfiguration for CSPs

For AWS Hosted VIF, Azure, and Google Cloud, Megaport can set up IP addressing and BGP on both the NAT Gateway and the CSP side. This minimizes the amount of switching between the CSP and Megaport portals. While the Portal handles autoconfiguration by default, you can also use the API to trigger it. The functionality is triggered when the interfaces key in partnerConfig does not exist or is null. To configure BGP peering for CSPs
  1. Create a request with this URL:
  2. Create the request Body with the configuration details. Templates for the most popular CSPs are available below.

AWS Hosted VIF

Google Cloud

Microsoft Azure

To see all options for the requests used in this example, see https://dev.megaport.com.
Last modified on August 21, 2026