> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Running steps across clouds

export const Comments = ({children}) => {
  return <div class="my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border border-zinc-500/20 bg-zinc-50/50 dark:border-zinc-500/30 dark:bg-zinc-500/10" data-callout-type="comments">
      <div class="w-4">
        <svg width="14" height="14" viewBox="0 0 640 640" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" aria-label="Comments">
            <path d="M320 112C434.9 112 528 205.1 528 320C528 434.9 434.9 528 320 528C205.1 528 112 434.9 112 320C112 205.1 205.1 112 320 112zM320 576C461.4 576 576 461.4 576 320C576 178.6 461.4 64 320 64C178.6 64 64 178.6 64 320C64 461.4 178.6 576 320 576zM280 400C266.7 400 256 410.7 256 424C256 437.3 266.7 448 280 448L360 448C373.3 448 384 437.3 384 424C384 410.7 373.3 400 360 400L352 400L352 312C352 298.7 341.3 288 328 288L280 288C266.7 288 256 298.7 256 312C256 325.3 266.7 336 280 336L304 336L304 400L280 400zM320 256C337.7 256 352 241.7 352 224C352 206.3 337.7 192 320 192C302.3 192 288 206.3 288 224C288 241.7 302.3 256 320 256z" />
        </svg>
      </div>
      <div class="text-sm prose min-w-0 w-full">
        {children}
      </div>
    </div>;
};

In Anaconda Platform, you can execute individual steps of a flow on different cloud providers, such as AWS, Azure, and GCP. Multi-cloud execution helps you:

* **Overcome constraints** related to resource availability and services offered.
* **Access specialized compute**, such as Trainium on AWS or TPUs on GCP.
* **Optimize spending** by moving compute to the most cost-efficient environment.
* **Respect data locality** by moving compute to data.

To run a step on a specific cloud, target a compute pool in that cloud with the `compute_pool` attribute of the `@kubernetes` decorator. Compute pools span clouds, so each pool belongs to one provider, and targeting the pool determines where the step runs.

## Scaling to another compute pool

<Note>
  The following example assumes your deployment has a compute pool that runs on another cloud provider. If your deployment does not have one, speak with your administrator.

  Your deployment's compute pools are listed on the **Pools** tab of the **Compute** page.
</Note>

The example runs part of a flow on a compute pool hosted on Azure while the rest of the flow runs on the deployment's default pools. Save this flow in `crosscloudflow.py`:

```python highlight={17} expandable theme={null}
from metaflow import FlowSpec, step, resources, kubernetes
import urllib

class CrossCloudFlow(FlowSpec):

    @kubernetes
    @step
    def start(self):
        req = urllib.request.Request('https://raw.githubusercontent.com/dominictarr/random-name/master/first-names.txt')
        with urllib.request.urlopen(req) as response:
            data = response.read()
        i = 0
        self.titles = data[:10]
        self.next(self.process, foreach='titles')

    @resources(cpu=1, memory=512)
    @kubernetes(compute_pool="<POOL_NAME>")
    @step
    def process(self):
        self.title = '%s processed' % self.input
        self.next(self.join)

    @step
    def join(self, inputs):
        self.results = [input.title for input in inputs]
        self.next(self.end)

    @step
    def end(self):
        print('\n'.join(self.results))

if __name__ == '__main__':
    CrossCloudFlow()
```

<Comments>
  Replace \<POOL\_NAME> with the name of a compute pool in your deployment that runs on another cloud.
</Comments>

The highlighted line moves the `process` step's compute to the named pool on another cloud. The remaining steps have no `compute_pool` attribute, so they run on the deployment's default pools in the primary cloud.

The flow illustrates a common pattern in cross-cloud processing:

1. The `start` step retrieves a dataset in the primary cloud.
2. The `process` step scales out to the other cloud.
3. The `join` step brings the results back to the primary cloud.

Run the flow:

```sh theme={null}
python crosscloudflow.py run --with kubernetes
```

<Tip>
  To watch the load shift between compute pools in real time, select **Compute** in the left-hand navigation and click **Pools**.

  ***

  When the run completes, the `process` step's tasks show the pool you named as their execution location.
</Tip>
