Home › Learn › Databricks interview prep › Asset Bundles
Databricks interview prep · data engineering
Asset Bundles: projects as code
What Databricks Asset Bundles are, a complete databricks.yml and job example, commands, CI/CD, hard problems and the Terraform split.
Defaults, limits and preview status change often. Check the current Databricks docs before quoting a number.
The pull request is the change; one command deploys it.
The idea
What a bundle is
A bundle is the whole Databricks project as files: jobs, pipelines, notebooks, permissions, cluster settings. They live in Git and one command deploys them to a workspace. UI-built jobs cannot be reviewed, promoted from dev to prod, or kept free of drift. In newer docs the feature is also called Declarative Automation Bundles; the command is still databricks bundle and the file databricks.yml. Check the current name and engine details.
my_project/ databricks.yml # name, targets, variables, includes resources/ingest_job.yml resources/sales_pipeline.yml src/ # notebooks, Python tests/
# databricks.yml
bundle:
name: sales_platform
include:
- resources/*.yml
variables:
catalog: { description: Target catalog, default: dev_catalog }
targets:
dev:
mode: development # prefixes names, pauses schedules
default: true
workspace: { host: https://dev.cloud.databricks.com }
prod:
mode: production
workspace: { host: https://prod.cloud.databricks.com }
variables: { catalog: prod_catalog }
run_as: { service_principal_name: "<application-id>" }# resources/ingest_job.yml
resources:
jobs:
ingest_job:
name: ingest_${bundle.target}
tasks:
- task_key: load
notebook_task:
notebook_path: ../src/load.py
base_parameters: { catalog: ${var.catalog} }
job_cluster_key: main
job_clusters:
- job_cluster_key: main
new_cluster: { spark_version: 15.4.x-scala2.12, node_type_id: i3.xlarge, num_workers: 2 }Commands
What to know
| Command | What it does |
|---|---|
| databricks bundle init | New project from a template |
| bundle validate | Check config and show the resolved result |
| bundle deploy -t prod | Upload files and create or update resources |
| bundle run JOB_NAME -t dev | Trigger a job or pipeline |
| bundle destroy -t dev | Delete everything the bundle deployed |
| bundle generate job | Turn an existing UI job into YAML |
| bundle deployment bind | Link an existing resource so deploy updates it instead of duplicating |
Concepts
Targets, modes, variables, identity
| Concept | Meaning |
|---|---|
| Targets | Environments (dev, staging, prod), each overriding workspace, variables, permissions and run identity |
| Development mode | Prefixes resource names with your user and pauses schedules, so people can deploy the same bundle without colliding |
| Production mode | Enforces safer rules, such as an explicit run_as and a non-personal root path |
| Variables | ${var.name}, set per target or with --var |
| Deployment state | Stored in the workspace; the CLI compares it with your config. Historically Terraform underneath, with a newer direct engine; check which is the default |
| run_as | Production jobs run as a service principal, not a person |
| Artifacts | Build and upload Python wheels and libraries |
CI/CD
A pipeline for bundles
- Pull request: validate, unit tests, deploy to a dev or staging target and run an integration job.
- Merge to main: deploy to staging, run smoke tests.
- Release tag: deploy to prod with a service principal using OIDC or a CI secret, never a personal token.
- Nobody edits prod in the UI; the next deploy overwrites it.
Hard problems
Problems and answers
| Problem | Answer |
|---|---|
| UI-created resources already exist in prod | bundle generate to capture them, then deployment bind so deploy adopts them. |
| Someone changed a job in the UI (drift) | Deploy overwrites it. Make only the service principal able to edit prod. |
| Same code, different catalogs and clusters per environment | Variables plus target overrides. Never hard-code catalog or workspace names in notebooks. |
| Renamed a job and the old one kept running | The resource key is the identity. Changing the key creates a new resource. Keep keys stable. |
| Secrets | Reference secret scopes. No values in YAML. |
| Monorepo with many teams | A bundle per domain, shared libraries as wheels, a common template, CODEOWNERS on target files. |
| Rollback | Redeploy the previous Git tag. Data is not rolled back; pair with Delta RESTORE if needed. |
| Unity Catalog objects and metastore | Bundles can manage some objects; check current support. Metastore and catalogs are usually Terraform. |
Compare
Bundles versus Terraform
| Bundles | Terraform provider | |
|---|---|---|
| Best for | Application layer: jobs, pipelines, notebooks, dashboards | Platform layer: workspaces, metastore, networking, catalogs, identities |
| Unit | A project with code files | Infrastructure state |
| Owner | Data engineers | Platform team |
Use both: Terraform for the foundation, bundles for what runs on it.
Practice
Questions to rehearse
- Why bundles instead of the UI or raw REST calls?
- How do you promote the same pipeline from dev to prod with different configs?
- What does mode: development change?
- How do you stop a prod job running as a person?
- Someone edited a job in the UI. What happens on the next deploy?
- How do you bring existing jobs under bundle management?
- Describe your CI pipeline for a bundle, including tests and secrets.
FAQ
Questions people ask
Do bundles replace Terraform?
No. They cover the application layer; Terraform covers the platform.
What is the identity of a deployed job?
Its resource key in the bundle, not its display name.
Next
Where to go next
All Databricks interview topics · All data engineering · Databricks on this site