action.skip

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:

  1. Look up NAT Gateway location details to find a location that supports the NAT Gateway speed you require.
  2. Look up available session counts to choose a valid session count for your NAT Gateway.
  3. Create the NAT Gateway design to generate a productUid for the NAT Gateway.
  4. Validate the NAT Gateway order using the productUid.
  5. Buy the NAT Gateway to provision the service.

To look up NAT Gateway location details

  1. Send a GET request to retrieve available locations.

    GET {baseUrl}/v3/locations
    
  2. Search the response for a location that includes natGatewaySpeedMbps in the diversityZones object.

    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 id value. 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

  1. Send a GET request to retrieve the available session count and speed combinations for NAT Gateways.

    GET {baseUrl}/v3/products/nat_gateways/sessions
    

    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] }
      ]
    }
    
  2. 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

  1. Create a request with this URL:

    POST {baseUrl}/v3/products/nat_gateways
    

    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.

  2. Create the request Body. You must include the locationId, productName, speed, term, and config fields. The config object requires an asn and a sessionCount. You can use the Megaport ASN: 133937.

    {
      "locationId": 60,
      "productName": "Test NAT Gateway",
      "speed": 1000,
      "term": 12,
      "config": {
        "asn": 133937,
        "sessionCount": 250000,
        "bgpShutdownDefault": false,
        "diversityZone": "blue"
      }
    }
    

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

  1. Create a request with this URL:

    POST {baseUrl}/v3/networkdesign/validate
    
  2. Create the request Body with the productUid from the previous step.

    [
        {
            "productUid": "abc12345-1234-1234-1234-abc123456789"
        }
    ]
    

A successful response (HTTP 200) confirms the order is valid. Proceed to purchase the NAT Gateway.

To purchase the NAT Gateway

  1. 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

    POST {baseUrl}/v3/networkdesign/buy
    

    Example Request Body

    [
        {
            "productUid": "abc12345-1234-1234-1234-abc123456789"
        }
    ]
    

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.