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
productUid for the NAT Gateway.
To get the productUid for the NAT Gateway
-
Send a GET request to retrieve your NAT Gateway products.
-
From the response, locate the
productUidfor the NAT Gateway you want to connect. This example uses this value:abc12345-1234-1234-1234-abc123456789
-
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
connectTypequery parameter, such as: -
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).
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— ThelocationIdof the locationproductUid— TheproductUidof the port at the locationOwnerUid— ThecompanyUidof the CSP
productUid).
-
Create a request with this URL:
- Create the request Body with the configuration details.
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.
BGP connections
You can configure multiple BGP connections per interface by adding abgpConnections array to the interfaces array of the A-End partner configuration:
Bidirectional Forwarding Detection (BFD)
Thebfd 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 anipRoutes 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 itsid 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
Example Request
Example Request Body
id.
To get a prefix list
Send a GET request. Replace
{prefixListId} with the ID from the prefix list summary.
Endpoint
Example Request
Example Request Body
Example Request
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
Example Request
Example Request Body
id.
To get a packet filter
Send a GET request. Replace
{packetFilterId} with the ID from the packet filter summary.
Endpoint
Example Request
Example Request Body
Example Request
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 theinterfaces key in partnerConfig does not exist or is null.
To configure BGP peering for CSPs
-
Create a request with this URL:
- Create the request Body with the configuration details. Templates for the most popular CSPs are available below.