CREATE GATEWAY

statementdeferredContainer services & dev tooling

docs.snowflake.com ↗

Object: GATEWAY

Creates a new gateway in the current schema. A gateway enables traffic splitting or shadow traffic across multiple service endpoints. Snowpark Container Services is available to accounts in AWS, Microsoft Azure, and Google Cloud Platform commercial regions, with some exceptions. For more information, see Available regions and considerations.

Syntax

supportedpartialnot supportednot scored

CREATE [ OR REPLACE ] GATEWAY [ IF NOT EXISTS ] <name>
  FROM SPECIFICATION <specification_text>

Parameters

NameRequiredDescription
namerequiredString that specifies the identifier for the gateway; it must be unique for the schema in which the gateway is created.
FROM SPECIFICATIONrequiredSpecifies the gateway specification inline. The specification defines a traffic split or shadow traffic configuration. For a traffic split gateway, the specification uses the following format:Copy code spec: type: traffic_split split_type: custom targets: - type: endpoint value: <db>.<schema>.<service>!<endpoint> weight: <weight> - type: endpoint value: <db>.<schema>.<service>!<endpoint> weight: <weight> For a shadow traffic gateway, the specification uses the following format: Preview Feature — Open Shadow traffic gateways are available to all accounts.Copy code spec: type: shadow_traffic primary: - type: endpoint value: <db>.<schema>.<service>!<endpoint> shadow: - type: endpoint value: <db>.<schema>.<service>!<endpoint> weight: <weight>
typeThe gateway configuration type. Supported values: traffic_split: Routes requests among target endpoints according to their weights. shadow_traffic: Routes all requests to one primary endpoint and mirrors a percentage of requests to one or more shadow endpoints.
split_typeFor a traffic_split gateway, the fixed value custom. Don’t specify this parameter for a shadow_traffic gateway.
targetsFor a traffic_split gateway, a list of target endpoints to route traffic to. Each target must specify:
  • type — Fixed value. Must be set to endpoint.
  • value — The fully qualified endpoint name in the format db.schema.service!endpoint. Each target endpoint must exist.
  • weight — The traffic weight for this endpoint, specified as an integer. All weights must add up to 100.
primaryFor a shadow_traffic gateway, a list containing exactly one primary endpoint. The primary endpoint receives all requests and returns responses to clients. Don’t specify weight for the primary endpoint.
shadowFor a shadow_traffic gateway, a list of one or more shadow endpoints. Each shadow endpoint receives a copy of the percentage of requests specified by weight. Responses from shadow endpoints aren’t returned to clients. Each shadow target uses the same type and value fields as a traffic split target. Set weight to an integer from 0 through 100. Weights for multiple shadow targets don’t need to add up to 100.

Usage notes

Access control requirements

A role used to execute this operation must have the following privileges at a minimum: Privilege | Object | Notes CREATE GATEWAY | Schema | Required to create a gateway in the schema. BIND SERVICE ENDPOINT | Account | Required to bind service endpoints to the gateway. USAGE | Database | Required on the database containing the gateway. USAGE | Schema | Required on the schema containing the gateway. USAGE | Service endpoints | Required on the target service endpoints. Grant the service role ALL_ENDPOINTS_USAGE to provide access. To grant the required privileges, use the following commands: For instructions on creating a custom role with a specified set of privileges, see Creating custom roles. For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.

Known gaps

Parts not fully supported, and recorded divergences from Snowflake.

See also

Referenced by