Skip to content

Gateways

Gateways handle the ingress traffic of running services. They provide services with HTTPS domains, handle authentication, distribute load, and perform auto-scaling. In order to run a service, you need to have at least one gateway set up.

dstack Sky

If you're using dstack Sky , the gateway is already set up for you.

Configuration

First, create a YAML file in your project folder. Its name must end with .dstack.yml (e.g. .dstack.yml or gateway.dstack.yml are both acceptable).

type: gateway
name: example-gateway

backend: aws
region: eu-west-1
domain: example.com

A domain name is required to create a gateway.

Reference

See the .dstack.yml reference for all supported configuration options and examples.

Creating and updating gateways

To create or update the gateway, simply call the dstack apply command:

$ dstack apply . -f examples/deployment/gateway.dstack.yml

The example-gateway doesn't exist. Create it? [y/n]: y

 BACKEND  REGION     NAME             HOSTNAME  DOMAIN       DEFAULT  STATUS
 aws      eu-west-1  example-gateway            example.com          submitted

Updating DNS records

Once the gateway is assigned a hostname, go to your domain's DNS settings and add an A DNS record for *.<gateway domain> (e.g., *.example.com) pointing to the gateway's hostname.

This will allow you to access runs and models using this domain.

Managing gateways

Deleting gateways

To delete a gateway, pass gateway configuration to dstack delete:

$ dstack delete . -f examples/deployment/gateway.dstack.yml

Listing gateways

The dstack gateway list command lists existing gateways and their status.

What's next?

  1. See services on how to run services
  2. Check the .dstack.yml reference for more details and examples