Skip to main content

Compute Configs

Cluster compute configs specify the resources your cluster will use. Cluster compute configs are optional, since Anyscale has defaults for all the values that the compute template can specify. Nevertheless, sometimes it's useful to specify some of the configs to override the default the values.

You might be familiar with Ray's cluster.yaml, which specifies a large number of configs in a single file. Cluster compute configs are subset of this file.


The following is a fully specified example of compute config:

cloud: my-cloud # You may specify `cloud_id` instead
- us-west-2a
name: head_node_type
instance_type: m5.8xlarge
- name: cpu_worker
instance_type: m5.8xlarge
min_workers: 2
max_workers: 10
use_spot: true
fallback_to_ondemand: true
- name: gpu_worker
instance_type: g4dn.4xlarge
min_workers: 2
max_workers: 10
- DeviceName: "/dev/sda1"
VolumeSize: 50
DeleteOnTermination: true
Arn: arn:aws:iam:etc
- SubnetId: subnet-etc
- sg-etc
AssociatePublicIpAddress: true
- ResourceType: instance
- Key: my-key
Value: my-value

Note that you can specify the following in your cluster compute configs:

  • A cloud, which defaults to your default cloud (set by an organization owner for the entire organization). On the SDK, this can only be specified as cloud_id. On the CLI, you may specify cloud (the cloud name) instead. The SDK example below show how to resolve a cloud into a cloud_id.
  • A head node type, which defaults to m5.8xlarge on AWS or n2-standard-32 on GCP.
  • A list of worker node types, which by default includes:
    • A CPU node type, which defaults to m5.8xlarge on AWS or n2-standard-32 on GCP.
    • A GPU node type, which defaults to g4dn.4xlarge on AWS or n1-standard-16-nvidia-t4-16gb-1 on GCP.
  • AWS-specific configs, which are supported properties that will be passed directly to AWS when starting the instances.

When specifying instance types, you may specify any instance type supported by Anyscale as detailed on this page. In addition to the instance type, node types allow you to specify:

  • The node type name, which is used in logs.
  • Spot instance usage, which defaults to false.
  • Fallback to On Demand (requires Spot instance usage to be set to true), which defaults to false.
  • A minimum and maximum number of workers.
  • Instance specific cloud configurations, including Capacity Reservation IDs.

Global max_workers is excluded from the compute config. It is no longer supported in Anyscale Ray 2.7+.


The advanced AWS-specific configuration (aws block) is passed directly to the EC2 API when creating instances. You can use this to configure special parameters for your instances such as EBS disk size, security groups, and the subnet it resides in. We support the fields listed in the example, and the settings are applied to all instances launched for your cluster.

Please use caution when setting advanced AWS-specific configuration. Incorrect settings may cause your cluster to fail. The content of these fields is not validated before being passed to AWS.

Creating a compute config

You can use your cluster configs definition to create a compute config using the CLI, the Python SDK and the HTTP API:

anyscale compute-config create my_compute_configs.yaml --name my-cluster-compute

For more information, you can check the full reference of the CLI, Python SDK and the HTTP API.

You can also create a cluster compute in the Web UI by navigating to "Configurations > Compute configs > Create a new config" to create a cluster compute config. You can also create one on the fly when you create a new cluster.

Create a new compute config in the configurations page


Capacity Reservations

Some instance types might be challenging to secure from cloud providers due to high demand or limited availability. Anyscale Clusters can utilize capacity reservations to ensure that you are able to launch the node types that you need for your workloads. To manage the capacity reservation configuration for a specific worker node type, you need to modify the Advanced Instance Configuration for that node. This can be done through the Web UI or through a compute config definition file.

To manage it from the Web UI, expand a Worker Node, then expand "Resources and instance config (advanced)", then click on the "Instance config" tab. You'll want to provide the following JSON, replacing the reservation ID with your own:

"CapacityReservationSpecification": {
"CapacityReservationTarget": {
"CapacityReservationId": "cr-0123456789abcdefg"

To manage capacity reservation from the Anyscale CLI or SDK, the following YAML example can be used:

cloud: my-cloud # You may specify `cloud_id` instead
- us-west-2a
name: head_node_type
instance_type: m5.8xlarge
- name: accelerated_worker
instance_type: p4d.24xlarge
min_workers: 1
max_workers: 1
CapacityReservationId: cr-0123456789abcdefg # Change to your reservation ID.