Skip to main content

Manage Lakebase with Databricks Asset Bundles

This guide helps you get started with Databricks Asset Bundles to manage Lakebase resources using infrastructure as code. You'll create a Lakebase project, add a development branch and endpoint, and learn how to manage these resources declaratively. This is a typical workflow for programmatically managing Databricks resources in development and testing environments.

For the complete bundle resource reference and all available configuration options, see bundle resources.

Prerequisites

Before you begin, you need:

Resource hierarchy

Lakebase resources follow a parent-child hierarchy: you create parent resources before children. For the full resource model (projects, branches, computes, databases, and more), see How projects are organized.

Order of operations for this guide: Project → Branch → Endpoint

1. Create a bundle configuration

Initialize a bundle using the default-minimal template. This creates a bundle folder with a databricks.yml and picks up your CLI configuration (including the workspace host).

Bash
databricks bundle init default-minimal

When prompted, enter a name for your bundle project (for example, lakebase-bundle). The CLI creates a directory with that name. Switch to the bundle directory:

Bash
cd lakebase-bundle

Modify your databricks.yml file to define a Lakebase project, branch, and endpoint. Add or update the resources section (and the bundle name if you like). For example:

YAML
bundle:
name: lakebase-app

resources:
postgres_projects:
my_app:
project_id: 'my-app'
display_name: 'My Application'
pg_version: 17

postgres_branches:
dev_branch:
parent: ${resources.postgres_projects.my_app.id}
branch_id: 'dev'
no_expiry: true

postgres_endpoints:
dev_endpoint:
parent: ${resources.postgres_branches.dev_branch.id}
endpoint_id: 'primary'
endpoint_type: 'ENDPOINT_TYPE_READ_WRITE'
autoscaling_limit_min_cu: 0.5
autoscaling_limit_max_cu: 2

About endpoints: When you create a Lakebase project, Databricks automatically provisions a default production branch with a read-write endpoint. However, any additional branches you create (like the dev branch above) must have their endpoints explicitly defined in your bundle configuration.

The project_id, branch_id, and endpoint_id values must follow the resource naming rules (for example, 1–63 characters, lowercase letters, numbers, and hyphens).

2. Validate the bundle

Check whether the bundle configuration is valid:

Bash
databricks bundle validate

If a summary of the bundle configuration is returned, the validation succeeded. If any errors are returned, fix the errors and repeat this step. See databricks bundle validate.

3. Deploy the bundle

Deploy the Lakebase project to your Databricks workspace:

Bash
databricks bundle deploy

This creates:

  • A Lakebase project named "my-app"
  • A default production branch with a read-write endpoint (created automatically)
  • A development branch named "dev"
  • A primary endpoint for the dev branch with autoscaling from 0.5 to 2 CU

See databricks bundle deploy.

4. Verify the deployment

Confirm the resources were created:

  1. In your Databricks workspace, navigate to LakebaseProjects.
  2. Click My Application.
  3. Verify that you see two branches:
    • production (Default) - Created automatically with 1 CU primary compute
    • dev - Created by your bundle with 0.5-2 CU autoscaling compute

5. Update the configuration

To modify your resources, update the databricks.yml file and redeploy:

Bash
databricks bundle validate
databricks bundle deploy

The bundle will update only the resources that changed.

6. Clean up resources

When you're done with the Lakebase project, you can delete it to free up resources.

The standard command for removing bundle resources is databricks bundle destroy. However, this command does not work for Lakebase projects because read-write endpoints cannot be deleted individually. Instead, use the Databricks CLI to delete the Lakebase project directly:

Bash
databricks postgres delete-project projects/my-app

This automatically cascades to delete all branches and endpoints.

Resource substitutions

The bundle configuration uses substitutions to reference resources:

  • ${resources.postgres_projects.my_app.id} - References the Lakebase project resource name
  • ${resources.postgres_branches.dev_branch.id} - References the branch resource name

This ensures proper dependency ordering during deployment. For more information about bundle substitutions, see Substitutions.

Available resources

For the full list of Lakebase resources supported in bundles and their configuration options, see bundle resources (postgres_projects, postgres_branches, postgres_endpoints).

Next steps