# Using a Self-Hosted Cloud

A Self-Hosted Cloud enables you to connect any cloud account or on-premise setup to a collection on Bluebricks. It requires installing the [Bluebricks Deployments Controller (BDC)](/docs/organization-and-security/bluebricks-self-hosted-runner.md): a Kubernetes operator that orchestrates IaC tasks in your own cluster.

## Prerequisites

* Kubernetes 1.28+
* Helm 3.8+
* `kubectl` configured and pointing at your target cluster
* A [Bluebricks collection](/docs/orchestration/collections/create-an-environment.md)

## Step 1: Install BDC in your cluster

Install the Bluebricks Deployments Controller using Helm:

```bash
helm install bdc \
  oci://europe-docker.pkg.dev/bbx-registry-prod/helm/bluebricks-deployments-controller
```

For custom configuration options (resource limits, environment variables, storage), see the [BDC Helm Chart](/docs/organization-and-security/bluebricks-self-hosted-runner/bdc-helm-chart.md) reference and the full [Self-Hosted Runner](/docs/organization-and-security/bluebricks-self-hosted-runner.md) guide.

## Step 2: Verify the installation

Check that the BDC pods are running:

```bash
kubectl get pods -n bluebricks
```

View the controller logs to confirm it started successfully:

```bash
kubectl logs -f deployment/bluebricks-deployments-controller -n bluebricks
```

## Step 3: Register the cluster

Run the Bluebricks registration script to connect your cluster to the platform:

```bash
/bin/bash -c "$(curl -fsSL https://brickscli.s3.eu-west-1.amazonaws.com/releases/latest/self-hosted-register.sh)"
```

The script will verify your Kubernetes context and guide you through a wizard to collect the necessary details. For more information on how registration and authentication work, see [Registration and Authentication](/docs/organization-and-security/bluebricks-self-hosted-runner/registration-and-authentication.md).

## Step 4: Connect in the Bluebricks app

After registration, add the self-hosted cloud account in the Bluebricks app:

1. Click **"Connect Cloud"** on the collection you want to link
2. Select **Self-Hosted** as the **Cloud Provider**
3. Fill in the required fields:

<table><thead><tr><th width="258.52734375">Field</th><th width="108.859375">Required</th><th>Description</th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>Yes</td><td>A display name for this cloud account</td></tr><tr><td><strong>Service account namespace</strong></td><td>Yes</td><td>Kubernetes namespace for the BDC service account (default: <code>bluebricks</code>)</td></tr><tr><td><strong>Service account name</strong></td><td>No</td><td>Name of the BDC service account (default: <code>bluebricks-deployments-controller-sa</code>)</td></tr><tr><td><strong>Cluster name</strong></td><td>Yes</td><td>Name of the target cluster. Find it with: <code>kubectl config current-context</code></td></tr><tr><td><strong>Cluster OIDC URL</strong></td><td>Yes</td><td>The OIDC issuer URL for your cluster. Find it with: <code>kubectl get --raw '/.well-known/openid-configuration' | jq -r .issuer</code></td></tr></tbody></table>

4. Click **"Connect & Create"** to complete the setup

## Managing cloud accounts

{% tabs %}
{% tab title="Bluebricks app" %}
From the collection detail page you can:

1. **View account details**: click the cloud account section to see provider attributes (read-only after creation).
2. **Switch accounts**: click **Edit** on the cloud account section, then select a different account or create a new one.
3. **Disconnect**: expand the disconnect section and confirm to remove the cloud account from the collection. This does not delete the account itself.
   {% endtab %}

{% tab title="CLI" %}

```bash
# List connected cloud accounts
bricks clouds ls

# Include inactive and deleted accounts
bricks clouds ls --all

# Delete a cloud account (not associated with a collection)
bricks clouds delete --slug <slug>
bricks clouds delete --id <id>
```

For the full command reference, see [`bricks clouds ls`](/docs/bricks-cli/cli-reference/bricks_clouds/bricks_clouds_ls.md) and [`bricks clouds delete`](/docs/bricks-cli/cli-reference/bricks_clouds/bricks_clouds_delete.md).
{% endtab %}
{% endtabs %}

[Learn more about managing cloud accounts](/docs/orchestration/collections/managing-collections.md)

## Next steps

* [Connect your Cloud](/docs/getting-started/connect-your-cloud.md): overview of all cloud connection types
* [Bluebricks Self-Hosted Runner](/docs/organization-and-security/bluebricks-self-hosted-runner.md): full BDC architecture and configuration
* [CLI Reference: bricks clouds](/docs/bricks-cli/cli-reference/bricks_clouds.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bluebricks.co/docs/organization-and-security/bluebricks-self-hosted-runner/what-is-a-self-hosted-cloud.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
