Creating a Megaport NAT Gateway with the API
This topic describes the API procedure to create a Megaport NAT Gateway (NAT Gateway), including how to look up locations, check available session counts, and place the order.
Before you begin, obtain a valid access token. For more information, see Creating an API Key.
To create a NAT Gateway, you need to:
- Look up NAT Gateway location details to find a location that supports the NAT Gateway speed you require.
- Look up available session counts to choose a valid session count for your NAT Gateway.
- Create the NAT Gateway design to generate a
productUidfor the NAT Gateway. - Validate the NAT Gateway order using the
productUid. - Buy the NAT Gateway to provision the service.
To look up NAT Gateway location details
-
Send a GET request to retrieve available locations.
-
Search the response for a location that includes
natGatewaySpeedMbpsin thediversityZonesobject.To provision a NAT Gateway at a location, your required speed must appear in
natGatewaySpeedMbps. Check that the location has your required speed and an available diversity zone.To create a NAT Gateway, you need the location
idvalue. In this example, the location ID is 60.{ "id": 60, "name": "CoreSite LA1", "address": { "street": "624 South Grand Avenue", "suburb": null, "city": "Los Angeles", "state": "CA", "postcode": "90017", "country": "USA" }, "metro": "Los Angeles", "market": "US", "status": "Active", "diversityZones": { "red": { "mcrSpeedMbps": [1000, 2500, 5000, 10000], "megaportSpeedMbps": [1000, 10000, 100000], "natGatewaySpeedMbps": [1000, 2500, 10000], "mveAvailable": true }, "blue": { "mcrSpeedMbps": [1000, 2500, 5000, 10000], "megaportSpeedMbps": [1000, 10000, 100000], "natGatewaySpeedMbps": [1000, 2500, 10000], "mveAvailable": true } } }
To look up available session counts
-
Send a GET request to retrieve the available session count and speed combinations for NAT Gateways.
The response shows the valid session counts for each supported speed.
{ "message": "Success", "data": [ { "speedMbps": 1000, "sessionCount": [250000, 500000] }, { "speedMbps": 2500, "sessionCount": [250000, 500000, 1000000] }, { "speedMbps": 5000, "sessionCount": [250000, 500000, 1000000] }, { "speedMbps": 10000, "sessionCount": [250000, 500000, 1000000, 2500000, 5000000, 10000000] }, { "speedMbps": 25000, "sessionCount": [500000, 1000000, 2500000, 5000000, 10000000] }, { "speedMbps": 50000, "sessionCount": [1000000, 2500000, 5000000, 10000000] } ] } -
Choose a speed and session count for your NAT Gateway. Both values are fixed for the life of the service.
To create the NAT Gateway design
-
Create a request with this URL:
Note
This request creates the NAT Gateway configuration but does not purchase or provision the service. To purchase the NAT Gateway, you need to validate and buy using the
productUid. -
Create the request Body. You must include the
locationId,productName,speed,term, andconfigfields. Theconfigobject requires anasnand asessionCount. You can use the Megaport ASN:133937.
A successful response returns the productUid for the new NAT Gateway. You need this ID to order the NAT Gateway.
{
"message": "Success",
"data": {
"productUid": "abc12345-1234-1234-1234-abc123456789",
"provisioningStatus": "DESIGN",
"productName": "Test NAT Gateway",
"speed": 1000,
"locationId": 60,
"config": {
"asn": 133937,
"sessionCount": 250000,
"bgpShutdownDefault": false,
"diversityZone": "blue"
},
"term": 12,
"autoRenewTerm": false,
"createDate": "2024-01-15T10:00:00Z",
"createdBy": "user@example.com"
}
}
To validate the NAT Gateway order
-
Create a request with this URL:
-
Create the request Body with the
productUidfrom the previous step.
A successful response (HTTP 200) confirms the order is valid. Proceed to purchase the NAT Gateway.
To purchase the NAT Gateway
-
Send a POST request to purchase and provision the NAT Gateway.
Use the same request Body as the validate step.
Important
If you make the buy API call on api.megaport.com, your account will be charged for the service. Alternatively, you can use the API in the staging environment (api-staging.megaport.com) without charges. For more information, see API Environments.
Endpoint
Example Request Body
If the purchase is successful, the response shows the ORDERED provisioning status and the NAT Gateway provisioning begins.
{
"message": "Success",
"data": {
"productUid": "abc12345-1234-1234-1234-abc123456789",
"provisioningStatus": "ORDERED",
"productName": "Test NAT Gateway",
"speed": 1000,
"locationId": 60,
"config": {
"asn": 133937,
"sessionCount": 250000,
"bgpShutdownDefault": false,
"diversityZone": "blue"
},
"term": 12,
"autoRenewTerm": false,
"createDate": "2024-01-15T10:00:00Z",
"createdBy": "user@example.com"
}
}
The new NAT Gateway now appears in your working environment, either portal.megaport.com or portal-staging.megaport.com.
The next step is to create VXCs on the NAT Gateway.
For more information, see Creating a NAT Gateway VXC with the API.