What you will be able to do
- Explain what a Declarative Automation Bundle packages and why it is used for CI/CD
- Structure a databricks.yml with resources, include and targets mappings
- Predict how target settings merge with or override top-level job and pipeline settings
- Use custom variables and per-target values to configure dev, test and prod
Key concept
Bundle (Declarative Automation Bundle) — A bundle is a project's source code plus YAML that defines its Databricks resources, such as Lakeflow Jobs and pipelines. The whole thing is deployed as one unit to a named target environment. Promoting the project means deploying the same bundle to a different target.
1.What a bundle packages
Declarative Automation Bundles were formerly called Databricks Asset Bundles, and you will still see both names. They bring software engineering practice to Databricks projects: source control, code review, testing and CI/CD. Without bundles, you create a job in the UI and its definition stays in the workspace. With a bundle, the job definition is a YAML file in the same repository as the notebooks it runs. It is versioned and reviewed with that code, and deployed with it.
According to the documentation, a bundle contains four kinds of things: the cloud infrastructure and workspace configuration it needs; source files such as notebooks and Python files that hold the business logic; definitions and settings for Databricks resources; and unit and integration tests. The resource types listed include Lakeflow Jobs, Lakeflow pipelines, dashboards, Model Serving endpoints, MLflow experiments and MLflow registered models. Databricks describes bundles as an infrastructure-as-code (IaC) approach. They fit best on complex projects with several contributors, where automation and CI/CD are required.
Bundles are a feature of the Databricks CLI. You write the YAML, then use the CLI to validate it, deploy it to a remote workspace and run the deployed workflows. You can also work with bundles directly in the workspace, which does not require installing the CLI.
Checkpoint 1 of 5· Check yourself
A team wants its Lakeflow Job and Lakeflow pipeline definitions to live next to the notebooks they run and be deployed with them. What does a bundle provide?
Bundles describe resources such as jobs and pipelines as source files. Those definitions are deployed together with the code they run.
“make it possible to describe Databricks resources such as jobs and pipelines as source files”Source: docs.databricks.com
Sources1
2.databricks.yml: the one root configuration file
Every bundle has exactly one file named databricks.yml at the root of the project folder. That file defines the bundle. It can pull in other YAML files, such as one file per job or pipeline, through the include mapping. The smallest valid configuration has a bundle name, which is required, and one target.
bundle:
name: my_bundle
targets:
dev:
default: trueLakeflow Jobs go under resources.jobs and Lakeflow pipelines go under resources.pipelines. Each one is keyed by a programmatic identifier that you choose. Other workspace assets have their own keys under resources, including dashboards, schemas, volumes, experiments and model_serving_endpoints. The other top-level mappings set defaults, and each target can override them.
| Mapping | What it holds |
|---|---|
| bundle | Required. The bundle name (required), plus optional settings such as cluster_id, deployment and git |
| include | Globs for extra configuration files, such as resource files, to merge into the bundle |
| variables | Custom variables used throughout the bundle, each with a description and default |
| workspace | host, profile, root_path and other workspace settings, unless a target overrides them |
| resources | Definitions of jobs, pipelines, dashboards, schemas, volumes and other resources |
| run_as / permissions | The identity that runs the bundle, and permissions applied to its resources |
| targets | Named deployment environments with default, mode, presets and per-target overrides |
Checkpoint 2 of 5· Check yourself
A project keeps its job definition in jobs.yml and its pipeline definition in pipelines.yml. How do these files become part of the bundle?
A bundle has only one databricks.yml. Other configuration files are brought in through its include mapping.
“it can reference other configuration files, such as resource configuration files, in the include mapping”Source: docs.databricks.com
3.Targets: one definition, environment-specific overrides
The targets mapping is how one bundle serves dev, test and prod. Each target is a named environment. Settings at the top level are the defaults. Settings inside a target are applied on top of those defaults when you deploy to that target. In the example below, prod points at a different workspace host and swaps the cluster ID. It does not repeat the notebook_task, because anything a target leaves out falls back to the top-level definition.
targets:
dev:
default: true
prod:
workspace:
host: https://<production-workspace-url>
resources:
jobs:
hello-job:
name: hello-job
tasks:
- task_key: hello-task
existing_cluster_id: 2345-678901-fabcd456Databricks recommends setting a host for each target rather than relying on the default mapping alone, because it makes the configuration more portable. When a host is set, the CLI looks for a profile with that host in your .databrickscfg file and uses it to authenticate.
resources:
jobs:
my-job:
name: my-job
job_clusters:
- job_cluster_key: my-cluster
new_cluster:
spark_version: 13.3.x-scala2.12
targets:
development:
resources:
jobs:
my-job:
name: my-job
job_clusters:
- job_cluster_key: my-cluster
new_cluster:
node_type_id: i3.xlarge
num_workers: 1The rule is to merge first, then let the target win on conflicts. If spark_version and num_workers were set at both levels, the target's values would replace the top-level ones, while node_type_id from the top level would remain. Each kind of setting has its own join key. Job clusters join on job_cluster_key, job tasks on task_key, and Lakeflow pipeline clusters on label (default or maintenance). Artifacts follow the same pattern: an artifact setting defined in a target takes precedence over the top-level one.
Checkpoint 3 of 5· Match them up
Match each key to the settings it joins between the top-level resources mapping and a target
Tap a term, then the definition that fits it.
Jobs join on job_cluster_key or task_key and pipelines join on the cluster label. A target's workspace mapping changes where that target deploys.
“For Lakeflow pipelines, use label within the cluster settings of a pipeline definition”Source: docs.databricks.com
4.Custom variables for per-environment values
Overriding whole resource blocks works, but often only one value changes between environments, such as a cluster ID or a notebook path. Custom variables handle this. You declare them in the variables mapping or in a variable-overrides.json file, give each a description and an optional default, and reference them anywhere in the configuration.
variables:
my_cluster_id:
description: The ID of an existing cluster.
default: 1234-567890-abcde123
my_notebook_path:
description: The path to an existing notebook.
default: ./hello.pyTo use a variable, write ${var.my_cluster_id}. To give a target its own value, set it under that target's variables mapping. The configuration specification shows this as <defined-variable-name>: <non-default-value> # value for this target. Bundles also provide built-in substitutions, such as ${bundle.target}, ${bundle.name}, ${workspace.host} and ${workspace.current_user.short_name}, so names and paths can include the environment or the deploying user.
Checkpoint 4 of 5· Check yourself
A job task needs the cluster ID held in the custom variable my_cluster_id. Which reference is correct?
Custom variables are referenced with the var prefix inside ${...}.
“To reference a custom variable within your bundle configuration, use the variable substitution ${var.<variable_name>}.”Source: docs.databricks.com
Reference ${var.my_cluster_id} in the job definition once, keep the dev value as the default, and set my_cluster_id under targets.prod.variables. The job definition stays in one place and only the value changes per target.
Checkpoint 5 of 5· Exam question
A data engineering team keeps a Lakeflow Job and a Lakeflow Spark Declarative Pipeline defined as source in a repository, and wants to promote the exact same resource definitions from a dev workspace to a prod workspace without hand-editing settings in the UI at each stage. Which capability of Declarative Automation Bundles addresses this directly?
Correct answer: A — A `databricks.yml` file declares the job and pipeline as code, and named targets override settings like the workspace host so the same definitions deploy consistently across environments.
- A. This describes the core mechanism of a bundle: resources are declared once in `databricks.yml`, and targets override host, variables, and other settings per environment so the same source deploys consistently across dev, test, and prod.
- B. There is no UI feature that auto-detects and replicates resource changes between workspaces through an audit-log approval flow; promotion across environments is driven by deploying bundle configuration, not by UI diffing.
- C. Jobs and pipelines do not natively synchronize configuration across workspaces based on shared catalog or schema names; each workspace's resources are independent unless a bundle deploys the same definitions to both.
- D. A cluster policy constrains compute settings for a single job run and has no mechanism for propagating or synchronizing configuration between separate workspaces.
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.Defining new_cluster under a target replaces the entire top-level new_cluster block.Why is that wrong?
Settings with the same join key are merged. The target value wins only for a field defined at both levels, and fields defined only at the top level are kept.
Covered in Targets: one definition, environment-specific overrides
2.Each subfolder of a bundle can have its own databricks.yml for its jobs or pipelines.Why is that wrong?
A bundle has exactly one databricks.yml, at the project root. Other YAML files are added through the include mapping.
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://docs.databricks.com/aws/en/dev-tools/bundlesOfficial docs
“Declarative Automation Bundles are an infrastructure-as-code (IaC) approach to managing your Databricks projects.”
↩︎ What a bundle packages“Definitions and settings for Databricks resources, such as Lakeflow Jobs, Lakeflow pipelines, Dashboards, Model Serving endpoints, MLflow Experiments, and MLflow registered models”
↩︎ What a bundle packages“Your bundle project's collection of source files and metadata is deployed as a single bundle to your target environment.”
↩︎ Key concept“make it possible to describe Databricks resources such as jobs and pipelines as source files”
↩︎ Checkpoint - 2.
“The simplest databricks.yml defines the bundle name, which is a required top-level mapping, and a target deployment.”
↩︎ databricks.yml: the one root configuration file“it falls back to use the notebook_task mapping within the top-level resources mapping”
↩︎ Targets: one definition, environment-specific overrides“Setting the host mapping instructs the Databricks CLI to find a matching profile in your .databrickscfg file”
↩︎ Targets: one definition, environment-specific overrides“<defined-variable-name>: <non-default-value> # value for this target”
↩︎ Custom variables for per-environment values“A bundle must contain one (and only one) configuration file named databricks.yml at the root of the bundle project folder.”
↩︎ Exam trap 2“it can reference other configuration files, such as resource configuration files, in the include mapping”
↩︎ Checkpoint - 3.
“allows you to specify information about the Databricks resources used by the bundle in the resources mapping in the bundle configuration”
↩︎ databricks.yml: the one root configuration file - 4.
“then the setting in the targets mapping takes precedence over the setting in the top-level resources mapping”
↩︎ Targets: one definition, environment-specific overrides“spark_version in the top-level resources mapping is combined with node_type_id and num_workers in the resources mapping in targets”
↩︎ Exam trap 1“spark_version in the top-level resources mapping is combined with node_type_id and num_workers in the resources mapping in targets”
↩︎ Prediction“For Lakeflow pipelines, use label within the cluster settings of a pipeline definition”
↩︎ Checkpoint - 5.
“Custom variables are declared in your bundle configuration files within the variables mapping or in a variable-overrides.json file.”
↩︎ Custom variables for per-environment values“To reference a custom variable within your bundle configuration, use the variable substitution ${var.<variable_name>}.”
↩︎ Checkpoint