Skip to content

Exports

Exports allow making resources from one project available to other projects. When a project exports a resource, the specified importer projects can see and use it as if it were their own.

Experimental

Exports are an experimental feature. Currently, SSH fleets and gateways can be exported.

An export is created in the exporter project and specifies the resources to export and the importer projects that will gain access to them.

Once an export is created, the importer projects can see the exported resources in their resource lists and use them for running tasks, dev environments, and services. Imported resources appear with a project prefix (e.g., team-a/my-fleet) to distinguish them from the project's own resources.

Required project role

The user creating or updating an export must have the project admin role on both the exporter project and any importer project they add. Alternatively, a global admin can add any project as an importer.

Manage exports

Create exports

Use the dstack export create command to create a new export. Specify the fleets to export with --fleet, the gateways to export with --gateway, and the importer projects with --importer:

$ dstack export create my-export --fleet my-fleet --gateway my-gateway --importer team-b
 NAME        FLEETS    GATEWAYS    IMPORTERS
 my-export   my-fleet  my-gateway  team-b

--fleet, --gateway, and --importer can be specified multiple times:

$ dstack export create shared-gpus --fleet gpu-fleet-1 --fleet gpu-fleet-2 --importer team-b --importer team-c
 NAME         FLEETS                    GATEWAYS  IMPORTERS
 shared-gpus  gpu-fleet-1, gpu-fleet-2  -         team-b, team-c

List exports

Use dstack export list (or simply dstack export) to list all exports in the project:

$ dstack export list
 NAME         FLEETS                    GATEWAYS    IMPORTERS
 my-export    my-fleet                  my-gateway  team-b
 shared-gpus  gpu-fleet-1, gpu-fleet-2  -           team-b, team-c

Update exports

Use the dstack export update command to add or remove fleets, gateways, and importers from an existing export:

$ dstack export update my-export --add-fleet another-fleet --add-importer team-c
 NAME        FLEETS                   GATEWAYS    IMPORTERS
 my-export   my-fleet, another-fleet  my-gateway  team-b, team-c

To remove a fleet, gateway, or importer:

$ dstack export update my-export --remove-importer team-b
 NAME        FLEETS                   GATEWAYS    IMPORTERS
 my-export   my-fleet, another-fleet  my-gateway  team-c

Delete exports

Use the dstack export delete command to delete an export. This revokes access for all importer projects:

$ dstack export delete my-export
Delete the export my-export? [y/n]: y
Export my-export deleted

Use -y to skip the confirmation prompt.

Global exports

Users with the global admin role can mark any export as a global export. Global exports are automatically imported into all projects, and their imports cannot be deleted.

$ dstack export create global-export --gateway shared-gateway --global
 NAME           FLEETS  GATEWAYS        IMPORTERS
 global-export  -       shared-gateway  *
Only promoting an export to global requires the global admin role. Regular project admins can add or remove resources, remove global status, or delete the export.

Access imported resources

From the importer project's perspective, use dstack import list (or simply dstack import) to list all imports in the project — i.e., all exports from other projects that this project has been granted access to:

$ dstack import list
 NAME              FLEETS                   GATEWAYS
 team-a/my-export  my-fleet, another-fleet  my-gateway

Imported fleets and gateways also appear in dstack fleet list and dstack gateway list in the <project>/<name> format:

$ dstack fleet list
 NAME                  NODES  GPU          SPOT  BACKEND  PRICE  STATUS  CREATED
 my-local-fleet        1      -            -     ssh      -      active  3 days ago
 team-a/my-fleet       2      A100:80GB:8  -     ssh      -      active  1 week ago
 team-a/another-fleet  1      H100:80GB:4  -     ssh      -      active  2 days ago

$ dstack gateway list
 NAME               BACKEND          HOSTNAME  DOMAIN                 DEFAULT  STATUS
 team-a/my-gateway  aws (eu-west-1)  10.0.0.4  gtw.mycompany.example           running

Imported resources can be used for runs just like the project's own resources.

type: service
image: nginx
port: 80

gateway: team-a/my-gateway

fleets:
- my-local-fleet
- team-a/my-fleet

Tenant isolation

Exported fleets share the same access model as regular fleets. See Tenant isolation for details.

What's next?

  1. Check the dstack export CLI reference
  2. Check the dstack import CLI reference
  3. Learn how to manage fleets
  4. Learn how to manage gateways
  5. Read about projects and project roles