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.

Maintenance commandsRow-level securityCompute choiceJoinsSkew and shuffleAQE, Photon, POCost and performance leversDeclarative and semanticAsset BundlesLakeflow ConnectUniFormVector Searchdbt and ODCSEgress and ingressMaintenance in picturesClustering and compactionMaintenance strategySlow writesBackup and recoveryTaggingQuestion bank

Defaults, limits and preview status change often. Check the current Databricks docs before quoting a number.

Project as files in Gitbundle validatebundle deploy -t targetRun as a serviceprincipal

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

CommandWhat it does
databricks bundle initNew project from a template
bundle validateCheck config and show the resolved result
bundle deploy -t prodUpload files and create or update resources
bundle run JOB_NAME -t devTrigger a job or pipeline
bundle destroy -t devDelete everything the bundle deployed
bundle generate jobTurn an existing UI job into YAML
bundle deployment bindLink an existing resource so deploy updates it instead of duplicating

Concepts

Targets, modes, variables, identity

ConceptMeaning
TargetsEnvironments (dev, staging, prod), each overriding workspace, variables, permissions and run identity
Development modePrefixes resource names with your user and pauses schedules, so people can deploy the same bundle without colliding
Production modeEnforces safer rules, such as an explicit run_as and a non-personal root path
Variables${var.name}, set per target or with --var
Deployment stateStored in the workspace; the CLI compares it with your config. Historically Terraform underneath, with a newer direct engine; check which is the default
run_asProduction jobs run as a service principal, not a person
ArtifactsBuild and upload Python wheels and libraries

CI/CD

A pipeline for bundles

  1. Pull request: validate, unit tests, deploy to a dev or staging target and run an integration job.
  2. Merge to main: deploy to staging, run smoke tests.
  3. Release tag: deploy to prod with a service principal using OIDC or a CI secret, never a personal token.
  4. Nobody edits prod in the UI; the next deploy overwrites it.

Hard problems

Problems and answers

ProblemAnswer
UI-created resources already exist in prodbundle 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 environmentVariables plus target overrides. Never hard-code catalog or workspace names in notebooks.
Renamed a job and the old one kept runningThe resource key is the identity. Changing the key creates a new resource. Keep keys stable.
SecretsReference secret scopes. No values in YAML.
Monorepo with many teamsA bundle per domain, shared libraries as wheels, a common template, CODEOWNERS on target files.
RollbackRedeploy the previous Git tag. Data is not rolled back; pair with Delta RESTORE if needed.
Unity Catalog objects and metastoreBundles can manage some objects; check current support. Metastore and catalogs are usually Terraform.

Compare

Bundles versus Terraform

BundlesTerraform provider
Best forApplication layer: jobs, pipelines, notebooks, dashboardsPlatform layer: workspaces, metastore, networking, catalogs, identities
UnitA project with code filesInfrastructure state
OwnerData engineersPlatform team

Use both: Terraform for the foundation, bundles for what runs on it.

Practice

Questions to rehearse

  1. Why bundles instead of the UI or raw REST calls?
  2. How do you promote the same pipeline from dev to prod with different configs?
  3. What does mode: development change?
  4. How do you stop a prod job running as a person?
  5. Someone edited a job in the UI. What happens on the next deploy?
  6. How do you bring existing jobs under bundle management?
  7. Describe your CI pipeline for a bundle, including tests and secrets.
In an interview, say: The bundle is the project as code. Targets give me environments, variables give me different configs, and a service principal runs production. Nobody edits prod by hand.

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