---
title: CLI
meta:
  description: Deploy your Tinybird project using the CLI.
---

# Deploying to Tinybird using the CLI

You can deploy your data projects to Tinybird Cloud directly from the command line using the [Tinybird CLI](/forward/dev-reference/commands).

To deploy to Tinybird Cloud, create a staging deployment using the `--cloud` flag. This prepares all the resources in the cloud environment. 

{% callout type="info" %}
If your project was initialized with `tb init --dev-mode local` or `tb init --dev-mode branch`, running `tb deploy` without explicit environment flags targets your cloud main workspace automatically.
{% /callout %}



{% steps %}

## Check the deployment

Before creating the deployment, you can check the deployment with the `--check` flag. This runs a series of checks to ensure the deployment is ready. This is similar to a dry run.

```shell
# Checks the deployment
tb --cloud deployment create --check
``` 

{% callout type="info" %}
The `--check` flag validates external connections to S3, Kafka, GCS, and databases referenced via table functions. For local success, set connection secrets with `tb secret set` and use `tb local start --use-aws-creds` for S3 connections.
{% /callout %}

## Create a staging deployment

Create a new staging deployment in Tinybird Cloud. Pass the `--wait` flag to wait for the deployment to finish:

```shell
# Prepares all resources in Tinybird Cloud
tb --cloud deployment create --wait
```

To run commands against the staging deployment, use the `--staging` flag. For example:

```shell
tb --staging --cloud endpoint ls
```

## Promote to live

When the staging deployment is ready, promote it to a live deployment in Tinybird Cloud:

```shell
# Enables the deployment in Tinybird Cloud
tb --cloud deployment promote
```

{% /steps %}

{% callout type="tip" %}
To deploy and promote in one step, use `tb deploy`. If you prefer explicit flags, run `tb --cloud deploy`.
{% /callout %}

## Next steps

- Learn about datafiles, like .datasource and .pipe files. See [Datafiles](/forward/dev-reference/datafiles).
- Browse the Tinybird CLI commands reference. See [Commands reference](/forward/dev-reference/commands).
