# Deploy and run on Scrapy Cloud

You now have a [working Scrapy project](setup.md#tutorial-setup) that you have
been running locally. Running your code locally is fine during development, but
for production you usually want something better.

You will now deploy and run your code on [Scrapy Cloud](../../../scrapy-cloud/get-started.md#scrapy-cloud),
which you can do [for free](../../../scrapy-cloud/pricing.md#sc-pricing).

## Deploy to Scrapy Cloud

### Claude Code

> [!NOTE]
> Uses [Agentic Web Data](../../../zyte-web-data/index.md#agentic-web-data).

1. Create a Scrapy Cloud project on the [Zyte dashboard](https://app.zyte.com/).
2. Once created, copy your Scrapy Cloud project ID from the browser
   URL bar.

   For example, if the URL is
   `https://app.zyte.com/p/000000/deploy?state=deploy`, `000000`
   is your Scrapy Cloud project ID.
3. Prompt **Claude Code** to:
   > Deploy to Scrapy Cloud project `000000`

   Replacing `000000` with your actual project ID.

### Copilot

> [!NOTE]
> Uses [Web Scraping Copilot](../../../copilot/index.md#copilot).

1. Create a Scrapy Cloud project on the [Zyte dashboard](https://app.zyte.com/).
2. Back to **Visual Studio Code**, select **Web Scraping Copilot** on
   the sidebar.
3. On the **Spiders** view title, click the **Deploy to Scrapy Cloud**
   button.
   ![image](web-scraping/tutorials/main/images/cloud/deploy-button.png)
4. Complete the interactive Scrapy Cloud setup steps.
   ![image](web-scraping/tutorials/main/images/cloud/interactive-steps.png)
5. Add the following to `web-scraping-tutorial/scrapinghub.yml`:
   ```yaml
   stacks:
       default: scrapy:2.14-20260217
   ```
6. Click the **Deploy to Scrapy Cloud** button again, and confirm.

Once your Scrapy project has been deployed to your Scrapy Cloud
project, you will see a `Run your spiders at: <link>` line in the
output.

### CLI

1. Create a Scrapy Cloud project on the [Zyte dashboard](https://app.zyte.com/).
2. Install the latest version of `shub`, the Scrapy Cloud
   command-line application:
   ```bash
   pip install --upgrade shub
   ```
3. Create a YAML file at `web-scraping-tutorial/scrapinghub.yml`
   with the following content:
   ```yaml
   stacks:
       default: scrapy:2.14-20260217
   ```
4. Copy your [Scrapy Cloud API key](https://app.zyte.com/o/settings/apikey) (*not* a Zyte API key) from the
   Zyte dashboard.
5. Run the following command and, when prompted, paste your API key
   and press `Enter`:
   ```bash
   shub login
   ```
6. On the [Zyte dashboard](https://app.zyte.com/), select your Scrapy Cloud project under
   **Scrapy Cloud Projects**, and copy your Scrapy Cloud project ID
   from the browser URL bar.

   For example, if the URL is `https://app.zyte.com/p/000000/jobs`,
   `000000` is your Scrapy Cloud project ID.
7. Make sure `web-scraping-tutorial` is your current working
   directory.
8. Run the following command, replacing `000000` with your actual
   project ID:
   ```bash
   shub deploy 000000
   ```

Your Scrapy project has now been deployed to your Scrapy Cloud project.

## Run a Scrapy Cloud job

Now that you have deployed your Scrapy project to your Scrapy Cloud project, it
is time to run one of your spiders on Scrapy Cloud:

1. On the [Zyte dashboard](https://app.zyte.com/), select your Scrapy Cloud project under **Scrapy
   Cloud Projects**.
   ![](web-scraping/tutorials/main/images/cloud/select-project.png)
2. On the **Dashboard** page of your project, select **Run** on the top-right
   corner.
   ![](web-scraping/tutorials/main/images/cloud/run.png)
3. On the **Run** dialog box:
   1. Select the **Spiders** field and, from the spider list that appears,
      select your spider name.
   2. Select **Run**.
      ![image](web-scraping/tutorials/main/images/cloud/run-run.png)

   A new Scrapy Cloud job will appear in the **Running** job list:
   ![](web-scraping/tutorials/main/images/cloud/running.png)

   Once the job finishes, it will move to the **Completed** job list:
   ![](web-scraping/tutorials/main/images/cloud/completed.png)
4. Follow the link from the **Job** column, **1/1**.
   ![](web-scraping/tutorials/main/images/cloud/job-link.png)
5. On the job page, select the **Items** tab.
   ![](web-scraping/tutorials/main/images/cloud/items.png)
6. On the **Items** page, select **Export › CSV**.
   ![](web-scraping/tutorials/main/images/cloud/export-csv.png)

The downloaded file will have the same data as the `books.csv` file that you
generated locally [with your first spider](setup.md#first-spider).

Continue to the [next chapter](antiban.md#tutorial-antiban) to learn how to avoid
website bans.
