Scaleway logo
Public Gateways API

Public Gateways API

Scaleway Public Gateways are building blocks for your infrastructure on Scaleway's public cloud. They sit at the border of Private Networks and provide access to/from other networks or the Internet. As well as this, Public Gateways offer a host of managed features and services to facilitate the management of resources in your Private Network, including NAT to map private IP addresses in the Private Network to the public IP address of the Public Gateway.

Tip

To create and manage your Private Networks, check out the VPC APIOpen in new context.

Concepts

Refer to our dedicated concepts pageOpen in new context to find definitions of all terminology related to Public Gateways, including NAT, SSH bastion and more.

Quickstart

  1. Configure your environment variables.

    Note

    This is an optional step that seeks to simplify your usage of the Public Gateways API.

    TerminalCode
    export SCW_SECRET_KEY="<API secret key>" export SCW_DEFAULT_ZONE="<Scaleway default Availability Zone>" export SCW_PROJECT_ID="<Scaleway Project ID>"
  2. Choose a Public Gateway type: Public Gateways come in different shapes and sizes, with different network capabilities and pricing. When you create your Public Gateway, you need to include the required Public Gateway type in the request. Use the following call to get a list of available Public Gateway offer types and their details:

    TerminalCode
    curl -X GET \ -H "X-Auth-Token: $SCW_SECRET_KEY" \ -H "Content-Type: application/json" \ "https://api.scaleway.com/vpc-gw/v2/zones/$SCW_DEFAULT_ZONE/gateway-types"
  3. Create a Public Gateway: run the following command to create a Public Gateway. You can customize the details in the payload (name, description, tags, etc) to your needs: use the information below to adjust the payload as necessary.

    TerminalCode
    curl -X POST \ -H "X-Auth-Token: $SCW_SECRET_KEY" \ -H "Content-Type: application/json" \ "https://api.scaleway.com/vpc-gw/v2/zones/$SCW_DEFAULT_ZONE/gateways" \ -d '{ "type": "VPC-GW-S", "name": "my-new-gateway", "tags": ["my-first-tag", "my-second-tag"], "project_id": "'"$SCW_PROJECT_ID"'" }'
    ParameterDescriptionValid values
    typeThe type of Public Gateway (commercial offer type) to create. Use the Gateway Types endpoint to get a list of offer types.Any valid offer type string, e.g. VPC-GW-S
    nameA name of your choice for the Public GatewayAny string containing only alphanumeric characters and dashes, e.g. my-new-gateway.
    tagsA list of tags to describe your Public Gateway. These can help you manage and filter your gateways.A list of alphanumeric strings, e.g. ["my-first-tag, my-second-tag
    project_idThe Scaleway Project ID to create the Public Gateway in.A valid Scaleway Project ID, e.g. f5fe13a0-b9c7-11ed-afa1-0242ac120002

    Note: Further parameters are available, but for the purposes of this quickstart we have included only the essentials. See the Create a Public Gateway endpoint documentation below for full details of all possible parameters.

  4. Get a list of your Public Gateways: run the following command to get a list of all your Public Gateways.

    TerminalCode
    curl -X GET \ -H "X-Auth-Token: $SCW_SECRET_KEY" \ -H "Content-Type: application/json" \ "https://api.scaleway.com/vpc-gw/v2/zones/$SCW_DEFAULT_ZONE/gateways"
  5. Attach a Private Network to a Public Gateway: run the following command to attach a Private Network to your Public Gateway, and make all the Gateway's services such as NAT available to the Private Network. You can customize the details in the payload to your needs: use the information below to adjust the payload as necessary.

    Tip

    If you haven't created a Private Network yet, see the Private NetworksOpen in new context documentation to learn how to do so. Ensure you retain the ID of the Private Network.

    TerminalCode
    curl -X POST \ -H "X-Auth-Token: $SCW_SECRET_KEY" \ -H "Content-Type: application/json" \ "https://api.scaleway.com/vpc-gw/v2/zones/$SCW_DEFAULT_ZONE/gateway-networks" \ -d '{ "gateway_id": "b1b2edda-9364-422d-93f2-ad04e6a054dc", "private_network_id": "548dbcc3-8b78-486f-a79a-c3f5a17642f9", "enable_masquerade": true }'

    This configuration will set up the Public Gateway as a NAT gateway, masquerading traffic sent to it to the outer internet to provide internet access to resources in the Private Network.

    ParameterDescriptionValid values
    gateway_idThe Public Gateway ID of an existing Public GatewayAny valid Public Gateway ID, e.g. b1b2edda-9364-422d-93f2-ad04e6a054dc
    private_network_idThe Private Network ID of an existing Private NetworkAny valid Private Network ID in the same Availability Zone as the Public Gateway, e.g. 548dbcc3-8b78-486f-a79a-c3f5a17642f9
    enable_masqueradeDefines whether the gateway should masquerade traffic for the attached Private Network (i.e. whether to enable dynamic NAT)A boolean value, e.g. true

    Note

    Further parameters are available, but for the purposes of this quickstart we have included only the essentials. See the Attach a gateway to a Private Network documentation below for full details of all possible parameters.

  6. Delete a Public Gateway: run the following call to delete your Public Gateway. Ensure that you replace <PUBLIC-GATEWAY-ID> in the URL with the ID of the Public Gateway you want to delete.

    TerminalCode
    curl -X DELETE \ -H "X-Auth-Token: $SCW_SECRET_KEY" \ -H "Content-Type: application/json" \ "https://api.scaleway.com/vpc-gw/v2/zones/$SCW_DEFAULT_ZONE/gateways/<PUBLIC-GATEWAY-ID>"

    The expected successful response is empty.

    Requirement

Technical limitations

The following limitations apply to Public Gateways:

  • A maximum of eight (8) Private Networks can be plugged into a single Public Gateway
  • Note that the Public Gateway takes some time to start up, and actions on it are impossible unless it is in the running state. To check the current state of a Public Gateway, use the Get a Public Gateway endpoint to get information for your gateway: the status field of the response will tell you if it is running or in another state.
  • For further information about Public Gateway limitations see our dedicated documentationOpen in new context.

Technical information

Availability Zones

Public Gateways can be deployed in the following Availability Zones:

NameAPI ID
Parisfr-par-1 fr-par-2
Milanit-mil-1
Amsterdamnl-ams-1 nl-ams-2 nl-ams-3
Warsawpl-waw-1 pl-waw-2 pl-waw-3

The Scaleway Public Gateways API is a zoned API, meaning that each call must specify in its path parameters the Availability Zone for the resources concerned by the call.

Going further

For more help using Scaleway Public Gateways, check out the following resources:

Tags