Skip to content

profiles.yml

Sometimes, you may want to reuse the same parameters across different .dstack.yml configurations.

This can be achieved by defining those parameters in a profile.

Profiles can be defined on the repository level (via the .dstack/profiles.yml file in the root directory of the repository) or on the global level (via the ~/.dstack/profiles.yml file).

Any profile can be marked as default so that it will be applied automatically for any run. Otherwise, you can refer to a specific profile via --profile NAME in dstack apply.

Example

profiles:
  - name: my-profile

    # The spot pololicy can be "spot", "on-demand", or "auto"
    spot_policy: auto

    # Limit the maximum price of the instance per hour
    max_price: 1.5

    # Stop any run if it runs longer that this duration
    max_duration: 1d

    # Use only these backends
    backends: [azure, lambda]

    # If set to true, this profile will be applied automatically
    default: true

The profile configuration supports many properties. See below.

Root reference

backends - (Optional) The backends to consider for provisioning (e.g., [aws, gcp]).
regions - (Optional) The regions to consider for provisioning (e.g., [eu-west-1, us-west4, westeurope]).
availability_zones - (Optional) The availability zones to consider for provisioning (e.g., [eu-west-1a, us-west4-a]).
instance_types - (Optional) The cloud-specific instance types to consider for provisioning (e.g., [p3.8xlarge, n1-standard-4]).
reservation - (Optional) The existing reservation to use for instance provisioning. Supports AWS Capacity Reservations and Capacity Blocks.
spot_policy - (Optional) The policy for provisioning spot or on-demand instances: spot, on-demand, or auto. Defaults to on-demand.
retry - (Optional) The policy for resubmitting the run. Defaults to false.
max_duration - (Optional) The maximum duration of a run (e.g., 2h, 1d, etc). After it elapses, the run is automatically stopped. Use off for unlimited duration. Defaults to off.
stop_duration - (Optional) The maximum duration of a run graceful stopping. After it elapses, the run is automatically forced stopped. This includes force detaching volumes used by the run. Use off for unlimited duration. Defaults to 5m.
max_price - (Optional) The maximum instance price per hour, in dollars.
creation_policy - (Optional) The policy for using instances from fleets. Defaults to reuse-or-create.
idle_duration - (Optional) Time to wait before terminating idle instances. Defaults to 5m for runs and 3d for fleets. Use off for unlimited duration.
utilization_policy - (Optional) Run termination policy based on utilization.
fleets - (Optional) The fleets considered for reuse.
tags - (Optional) The custom tags to associate with the resource. The tags are also propagated to the underlying backend resources. If there is a conflict with backend-level tags, does not override them.
name - The name of the profile that can be passed as --profile to dstack apply.
default - (Optional) If set to true, dstack apply will use this profile by default..

retry

on_events - (Optional) The list of events that should be handled with retry. Supported events are no-capacity, interruption, and error. Omit to retry on all events.
duration - (Optional) The maximum period of retrying the run, e.g., 4h or 1d.