# Deploy a Custom Script to Data 360 Sandbox by Using CLI

The deployment process packages your Python script, its dependencies, and Data 360 configuration, and then uploads them to Data 360.

:::important
**DMO-DMO Transform Limitation:** If your script performs DMO-DMO transforms (transforms that read from and write to data model objects), `sf data-code-extension script deploy` doesn't work as intended. Use the UI deployment instead. See [Deploy a Custom Script to Data 360 Sandbox by Using UI](/docs/data/data-cloud-code-ext/guide/deploy-custom-code.md).
:::

| Edition Table                                                                                                                                                                                                 |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Available in: **Developer**, **Enterprise**, **Performance**, and **Unlimited** Editions. See [Data 360 edition availability](https://help.salesforce.com/s/articleView?id=sf.c360_a_dc_editions.htm&type=5). |

| User Permissions Needed                                                                 |                                                        |
| --------------------------------------------------------------------------------------- | ------------------------------------------------------ |
| To deploy a custom script and invoke code extension by creating a batch data transform: | Permission set: <ul><li>Data Cloud Architect</li></ul> |

## Prerequisites

- Write your custom script and validate it locally against a sandbox. See [Write and Validate Custom Scripts](/docs/data/data-cloud-code-ext/guide/author-custom-script.md).

***

## Steps to Deploy Your Custom Script and Invoke Code Extension by Creating a Batch Data Transform

1. Open a terminal, and go to the root of your code extension script package (the folder that contains `payload/`).

   ```bash
   cd <path-to-root-folder-of-customscript>
   ```

2. Make sure that you're logged in to your sandbox.

   ```bash
   sf org display --target-org <org_alias>
   ```

3. Deploy your code extension script.

   ```bash
   sf data-code-extension script deploy --name <deployment_name> --package-version <package_version> --description "<description>" --package-dir ./payload --target-org <org_alias> --cpu-size [CPU_L|CPU_XL|CPU_2XL|CPU_4XL]
   ```

- `--name <deployment_name>` (required): Name for your code extension deployment and batch data transform.
- `--package-version <package_version>` (required): Semantic version for the package (for example `1.0.0`).
- `--description "<description>"` (required): Short description of the deployment.
- `--package-dir ./payload` (required): Directory that contains your packaged script (typically `./payload` under the package root).
- `--target-org <org_alias>` (required): Org username or alias.
- `--cpu-size` (optional): CPU size for the deployment. Available options are `CPU_L`, `CPU_XL`, `CPU_2XL`, and `CPU_4XL`. The default is CPU_XL. Larger sizes provide more vCPUs and memory but consume more credits.
- `--network` (optional): Network setting for packages that include Jupyter notebooks (for example `host` for host network mode).

  **Example:**

  ```bash
  sf data-code-extension script deploy --name my_custom_script --package-version 1.0.0 --description "Uppercase Account Description transformation" --package-dir ./payload --target-org myorg --cpu-size CPU_L
  ```

4. Confirm that the code deployment is successful. See [Deployment Details](/docs/data/data-cloud-code-ext/guide/view-deployment-details.md).

## Next Step

- [Run Code Extension by Running a Batch Data Transform](/docs/data/data-cloud-code-ext/guide/invoke.md)
