|
| 1 | +--- |
| 2 | +title: Exports |
| 3 | +description: Exporting resources across projects |
| 4 | +--- |
| 5 | + |
| 6 | +# Exports |
| 7 | + |
| 8 | +Exports allow making resources from one project available to other projects. When a project exports a resource, |
| 9 | +the specified importer projects can see and use it as if it were their own. |
| 10 | + |
| 11 | +!!! warning "Experimental" |
| 12 | + Exports are an experimental feature. |
| 13 | + Currently, only [SSH fleets](fleets.md#ssh-fleets) can be exported. |
| 14 | + |
| 15 | +An export is created in the exporter project and specifies the resources to export and the |
| 16 | +importer projects that will gain access to them. |
| 17 | + |
| 18 | +Once an export is created, the importer projects can see the exported resources in their resource lists and use them |
| 19 | +for running tasks, dev environments, and services. Imported resources appear with a project prefix |
| 20 | +(e.g., `team-a/my-fleet`) to distinguish them from the project's own resources. |
| 21 | + |
| 22 | +!!! info "Required project role" |
| 23 | + The user creating or updating an export must have the project admin role on both the exporter project and |
| 24 | + any importer project they add. Alternatively, a global admin can add any project as an importer. |
| 25 | + |
| 26 | +## Manage exports |
| 27 | + |
| 28 | +### Create exports |
| 29 | + |
| 30 | +Use the `dstack export create` command to create a new export. Specify the fleets to export |
| 31 | +with `--fleet` and the importer projects with `--importer`: |
| 32 | + |
| 33 | +<div class="termy"> |
| 34 | + |
| 35 | +```shell |
| 36 | +$ dstack export create my-export --fleet my-fleet --importer team-b |
| 37 | + NAME FLEETS IMPORTERS |
| 38 | + my-export my-fleet team-b |
| 39 | + |
| 40 | +``` |
| 41 | + |
| 42 | +</div> |
| 43 | + |
| 44 | +Both `--fleet` and `--importer` can be specified multiple times: |
| 45 | + |
| 46 | +<div class="termy"> |
| 47 | + |
| 48 | +```shell |
| 49 | +$ dstack export create shared-gpus --fleet gpu-fleet-1 --fleet gpu-fleet-2 --importer team-b --importer team-c |
| 50 | + NAME FLEETS IMPORTERS |
| 51 | + shared-gpus gpu-fleet-1, gpu-fleet-2 team-b, team-c |
| 52 | + |
| 53 | +``` |
| 54 | + |
| 55 | +</div> |
| 56 | + |
| 57 | +### List exports |
| 58 | + |
| 59 | +Use `dstack export list` (or simply `dstack export`) to list all exports in the project: |
| 60 | + |
| 61 | +<div class="termy"> |
| 62 | + |
| 63 | +```shell |
| 64 | +$ dstack export list |
| 65 | + NAME FLEETS IMPORTERS |
| 66 | + my-export my-fleet team-b |
| 67 | + shared-gpus gpu-fleet-1, gpu-fleet-2 team-b, team-c |
| 68 | + |
| 69 | +``` |
| 70 | + |
| 71 | +</div> |
| 72 | + |
| 73 | +### Update exports |
| 74 | + |
| 75 | +Use the `dstack export update` command to add or remove fleets and importers from an existing export: |
| 76 | + |
| 77 | +<div class="termy"> |
| 78 | + |
| 79 | +```shell |
| 80 | +$ dstack export update my-export --add-fleet another-fleet --add-importer team-c |
| 81 | + NAME FLEETS IMPORTERS |
| 82 | + my-export my-fleet, another-fleet team-b, team-c |
| 83 | + |
| 84 | +``` |
| 85 | + |
| 86 | +</div> |
| 87 | + |
| 88 | +To remove a fleet or importer: |
| 89 | + |
| 90 | +<div class="termy"> |
| 91 | + |
| 92 | +```shell |
| 93 | +$ dstack export update my-export --remove-importer team-b |
| 94 | + NAME FLEETS IMPORTERS |
| 95 | + my-export my-fleet, another-fleet team-c |
| 96 | + |
| 97 | +``` |
| 98 | + |
| 99 | +</div> |
| 100 | + |
| 101 | +### Delete exports |
| 102 | + |
| 103 | +Use the `dstack export delete` command to delete an export. This revokes access for all importer projects: |
| 104 | + |
| 105 | +<div class="termy"> |
| 106 | + |
| 107 | +```shell |
| 108 | +$ dstack export delete my-export |
| 109 | +Delete the export my-export? [y/n]: y |
| 110 | +Export my-export deleted |
| 111 | +``` |
| 112 | + |
| 113 | +</div> |
| 114 | + |
| 115 | +Use `-y` to skip the confirmation prompt. |
| 116 | + |
| 117 | +## Access imported fleets |
| 118 | + |
| 119 | +From the importer project's perspective, exported fleets appear automatically in `dstack fleet list` |
| 120 | +with a `<project>/<fleet>` prefix: |
| 121 | + |
| 122 | +<div class="termy"> |
| 123 | + |
| 124 | +```shell |
| 125 | +$ dstack fleet list |
| 126 | + NAME NODES GPU SPOT BACKEND PRICE STATUS CREATED |
| 127 | + my-local-fleet 1 - - ssh - active 3 days ago |
| 128 | + team-a/my-fleet 2 A100:80GB:8 - ssh - active 1 week ago |
| 129 | + team-a/another-fleet 1 H100:80GB:4 - ssh - active 2 days ago |
| 130 | + |
| 131 | +``` |
| 132 | + |
| 133 | +</div> |
| 134 | + |
| 135 | +Imported fleets can be used for runs just like the project's own fleets. |
| 136 | + |
| 137 | +!!! info "Tenant isolation" |
| 138 | + Exported fleets share the same access model as regular fleets. See [Tenant isolation](fleets.md#tenant-isolation) for details. |
| 139 | + |
| 140 | +!!! info "What's next?" |
| 141 | + 1. Check the [`dstack export` CLI reference](../reference/cli/dstack/export.md) |
| 142 | + 2. Learn how to manage [fleets](fleets.md) |
| 143 | + 3. Read about [projects](projects.md) and project roles |
0 commit comments