---
title: tb infra
meta:
   description: Select the infrastructure on which you want to run Tinybird.
---

# tb infra

Helps you deploy Tinybird on a cloud service provider of your choice and manage custom regions. See [Self-managed Tinybird Cloud](/forward/install-tinybird/self-managed).

To list, add, update, or remove infrastructure regions, you can also go to **Settings**, **Managed regions** in Tinybird Cloud.

## Subcommands

The following subcommands are available:

{% table %}
  * Subcommand
  * Description
  ---
  * init
  * Initializes the infrastructure and deploys Tinybird Local in a custom region. By default, the command is interactive and prompts you for the necessary information.
  ---
  * add
  * Adds a new self-managed infrastructure region using an existing infrastructure URL.
  ---
  * update
  * Updates the URL of an existing self-managed infrastructure region.
  ---
  * rm NAME
  * Removes an existing infrastructure region.
  ---
  * ls
  * Lists available infrastructure regions.
{% /table %} 

## tb infra init

Initializes the selected cloud infrastructure provider to host Tinybird Local.

Running the `tb infra init` command requires the following components:

{% snippet title="tbinfra-prerequisites" /%}

The command requires the following information:

{% snippet title="tbinfra-init" /%}

Review the changes before applying them. If you want to generate the files without applying them, use the `--skip-apply` flag.

After the deployment is complete, `tb infra` shows the URL to access your Tinybird Local instance. See [tb infra](/forward/dev-reference/commands/tb-infra) for more information and settings.

The following options are available:

{% table %}
  * Option
  * Description
  ---
  * --name TEXT
  * Name for identifying the self-managed infrastructure region in Tinybird.
  ---
  * --cloud-provider TEXT
  * Infrastructure provider. Possible values are: `aws`, `gcp`, `azure`.
  ---
  * --cloud-region TEXT
  * AWS region, when using `aws` as the provider.
  ---
  * --dns-zone-name TEXT
  * DNS zone name.
  ---
  * --kubernetes-namespace TEXT
  * Kubernetes namespace for the deployment.
  ---
  * --dns-record TEXT
  * DNS record name to create, without domain. For example, `tinybird`.
  ---
  * --kubernetes-storage-class TEXT
  * Storage class for the Kubernetes StatefulSet.
  ---
  * --skip-apply
  * Create all the configuration files without applying them.
  ---
  * --auto-apply
  * Apply all the configuration automatically, without prompting for confirmation.
{% /table %} 

The command always generates the following files inside the `infra/<provider>` directory, where `<provider>` is the infrastructure provider:

- config.json: Contains the configuration for the provider.
- k8s.yaml: Contains the Kubernetes configuration.
- main.tf: Contains the Terraform configuration.

## tb infra add

Adds a new self-managed infrastructure region using an existing infrastructure URL. The command prompts you for the necessary information.

For example:

```bash
tb infra add

Running against Tinybird Cloud: Workspace example_workspace
Enter name: example
Enter host: https://tinybird.example.com
» Adding infrastructure 'example' in Tinybird...
✓ Infrastructure 'example' added
» Required environment variables:
TB_INFRA_TOKEN=example_token
TB_INFRA_WORKSPACE=example_workspace
TB_INFRA_ORGANIZATION=example_organization
TB_INFRA_USER=user@example.com
```

The following options are available:

{% table %}
  * Option
  * Description
  ---
  * --name TEXT
  * Name for identifying the self-managed infrastructure in Tinybird.
  ---
  * --host TEXT
  * Host for the infrastructure.
{% /table %} 

## tb infra update

Updates an existing infrastructure region.

For example:

```bash
tb infra update example --host https://tinybird-2.example.com

Running against Tinybird Cloud: Workspace example_workspace
» Updating infrastructure 'test' in Tinybird...
```

The following options are available:

{% table %}
  * Option
  * Description
  ---
  * --name TEXT
  * Name for identifying the self-managed infrastructure in Tinybird.
  ---
  * --host TEXT
  * Host for the infrastructure.
{% /table %} 

## tb infra rm

Removes an existing infrastructure region.

For example:

```bash
tb infra rm example

Running against Tinybird Cloud: Workspace example_workspace
» Deleting infrastructure 'example' from Tinybird...
✓ Infrastructure 'example' deleted
```

## tb infra ls

Lists all the infrastructure regions.

For example:

```bash
tb infra ls

Running against Tinybird Cloud: Workspace example_workspace
** Infras:
--------------------------------------------------------------------------
| name         | host                                                    |
--------------------------------------------------------------------------
| example      | https://tinybird.example.com                            |
| example2     | https://tinybird2.example.com                           |
--------------------------------------------------------------------------
```

## Environment support

{% table %}
  * Environment
  * Supported
  * Description
  ---
  * `--local`
  * ✗ No
  * Infrastructure management requires cloud.
  ---
  * `--cloud`
  * ✓ Yes (implicit)
  * Manages self-managed infrastructure regions.
  ---
  * `--branch=BRANCH_NAME`
  * ✗ No
  * Infrastructure is managed at account level, not in branches.
{% /table %}
