What you will be able to do
- Describe the structure of
databricks.ymland its top-level mappings - Declare MLflow experiments, Unity Catalog registered models and model serving endpoints as bundle resources
- Vary settings between dev, staging and prod using targets, target overrides, variables and deployment modes
- Validate, deploy, run and destroy a bundle for a chosen target
1.The anatomy of a bundle
Declarative Automation Bundles (formerly called Databricks Asset Bundles, or DABs) manage Databricks projects as infrastructure-as-code. A bundle is the complete definition of a project. It holds the source files with your business logic, plus the definitions and settings for the Databricks resources that run them. For ML projects, those resources include Model Serving endpoints, MLflow experiments and MLflow registered models, alongside jobs and pipelines. Everything is written in YAML and kept next to the code, so it gets the same source control, code review and CI/CD.
Every bundle has exactly one main configuration file, databricks.yml, at the root of the project. It can pull in other configuration files, such as per-resource YAML files, through the include mapping. The only required top-level mapping is bundle with a name. In practice you also add targets, the environments you deploy to. Other top-level mappings in the specification include run_as, include, scripts, sync, artifacts, variables, workspace, permissions and resources.
bundle:
name: my_bundle
targets:
dev:
default: trueCheckpoint 1 of 7· Check yourself
A team wants to keep each ML resource definition in its own YAML file. How should the bundle be organised?
A bundle has exactly one databricks.yml at its root. Other configuration files are added through include, for example include: - '*.yml'.
“A bundle must contain one (and only one) configuration file named databricks.yml at the root of the bundle project folder.”Source: docs.databricks.com
Checkpoint 2 of 7· Exam question
An MLOps engineer is authoring a Databricks Asset Bundle (DAB) and needs the bundle deploy to create and manage a real-time serving endpoint for a Unity Catalog model, fully described in version-controlled YAML alongside the training job. Under which top-level `resources` key should this endpoint be declared?
Correct answer: A — model_serving_endpoints
- A. model_serving_endpoints is the resource key Databricks Asset Bundles use for declaring a Model Serving endpoint, including its served_entities and traffic_config, in the resources section.
- B. serving_endpoints is not a recognized Databricks Asset Bundle resource key; the bundle schema uses the fuller model_serving_endpoints name for this resource type.
- C. model_endpoints is not a valid Databricks Asset Bundle resource key; no such shortened name exists in the resources schema.
- D. endpoints alone is too generic and is not the resource key the bundle schema expects for Model Serving endpoints.
2.Declaring experiments, registered models and serving endpoints
Each resource in the resources mapping maps to a Databricks REST API object, and the keys it accepts are that API's create-request fields written as YAML. In an experiment declaration, the keys follow the POST /api/2.0/mlflow/experiments/create payload. In a model declaration, they follow the Unity Catalog POST /api/2.1/unity-catalog/models payload. If you already have an asset in the workspace, databricks bundle generate writes the YAML for it.
| Resource key | What it defines | Fields used in the doc examples |
|---|---|---|
| experiments | An MLflow experiment | name, permissions, tags |
| registered_models | A registered model in Unity Catalog | name, catalog_name, schema_name, comment, grants |
| model_serving_endpoints | A model serving endpoint | name, config, tags |
resources:
experiments:
experiment:
name: /Workspace/Users/someone@example.com/my_experiment
permissions:
- level: CAN_READ
group_name: users
tags:
- key: mlflow.note.content
value: MLflow experiment used to track runsresources:
registered_models:
model:
name: my_model
catalog_name: ${bundle.target}
schema_name: mlops_schema
comment: Registered model in Unity Catalog for ${bundle.target} deployment target
grants:
- privileges:
- EXECUTE
principal: account usersThe substitution resolves to the target name. Deploying to dev creates the model in a catalog named dev, and deploying to prod creates it in a catalog named prod, both under mlops_schema. One resource definition therefore gives each environment its own Unity Catalog location.
A serving endpoint's config lists the served_entities it serves. Each entry names a Unity Catalog model by its full catalog.schema.model name and can set entity_name, entity_version, workload_size, scale_to_zero_enabled, workload_type and environment_vars. traffic_config.routes sets what percentage of requests each served model receives. The older served_models field is deprecated.
Checkpoint 3 of 7· Fill the gap
Which key completes this Unity Catalog model serving endpoint definition?
resources:
model_serving_endpoints:
uc_model_serving_endpoint:
name: 'uc-model-endpoint'
config:
? :
- entity_name: 'myCatalog.mySchema.my-ads-model'
entity_version: '10'
workload_size: 'Small'
scale_to_zero_enabled: 'true'
traffic_config:
routes:
- served_model_name: 'my-ads-model-10'
traffic_percentage: '100'served_entities is the current list of what the endpoint serves. served_models still appears in the reference, but only as a deprecated field.
Source: docs.databricks.comCheckpoint 4 of 7· Exam question
A bundle's `model_serving_endpoints` resource must point its serving traffic at version 4 of the Unity Catalog model `prod.fraud.fraud_scorer`. Which pair of fields inside `served_entities` correctly identifies this exact model and version for the endpoint to serve?
Correct answer: A — Set `entity_name` to `prod.fraud.fraud_scorer` and `entity_version` to `4`, so the served entity resolves to that exact catalog.schema.model version.
- A. entity_name takes the full three-level catalog.schema.model path and entity_version takes the specific version number, which is exactly how a served_entities block pins traffic to one registered model version.
- B. The served_entities schema does not use bare name and version fields; those are MLflow client-side registration parameters, not the keys the serving endpoint resource expects.
- C. Splitting the model into a bare model_name plus treating the version number as an alias is incorrect; entity_name must carry the full namespace and entity_version is a separate numeric field, not an alias.
- D. There is no catalog_schema field in served_entities, and entity_name must include the model's full three-level path rather than just the model portion.
3.Targets: one definition, many environments
The targets mapping is where a bundle meets the dev/staging/prod design. Each target can set its own workspace (for example a different host), resources, variables, permissions, run_as and mode. Exactly one target can be marked default: true. Databricks recommends setting host instead of relying on default wherever possible, because it makes the configuration more portable.
You never have to copy a whole resource into each target. A target lists only the fields it changes, and every other field comes from the top-level resources mapping. In the example below, prod points at a different workspace and swaps the cluster ID, while notebook_task still comes from the top-level definition. The same pattern would let a serving endpoint run with a different workload size in prod.
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-fabcd456Variables are the second way to vary settings. You declare them in the top-level variables mapping with a description and a default, refer to them inside resources, and give a different value in each target's variables block.
Deployment modes are optional presets on a target. mode: development prefixes every resource that is not deployed as a file or notebook with [dev ${workspace.current_user.short_name}] and adds a dev tag to deployed jobs and pipelines. That way several developers can deploy the same bundle into one dev workspace without clashing.
targets:
dev:
mode: developmentCheckpoint 5 of 7· Check yourself
A team wants one shared resource definition that uses a different value for a setting in each environment, without duplicating the resource per target. Which approach does the bundle specification support?
A target's variables block supplies its own value for a variable declared at the top level. Overriding just that field in the target's resources block also works.
“<defined-variable-name>: <non-default-value> # value for this target”Source: docs.databricks.com
Checkpoint 6 of 7· Exam question
A team is running a canary rollout of a new fraud-scoring model version and wants 90% of production traffic to keep hitting the currently serving version while 10% is routed to the new candidate for evaluation. Which part of the `model_serving_endpoints` resource controls this traffic split?
Correct answer: A — The `traffic_config.routes` list, where each route pairs a `served_model_name` with a `traffic_percent` that together must sum to 100 across all routes.
- A. The routes list under traffic_config is exactly where the endpoint's inbound percentage split across served models is defined, and Databricks requires the traffic_percent values across all routes to add up to 100.
- B. workload_size controls the compute resources backing a served entity for handling load, not how inbound requests are proportionally routed between multiple served entities.
- C. Permissions govern who can query or manage the endpoint, not how traffic is proportioned among the models it serves; there is no weighting mechanism inside the permissions block.
- D. scale_to_zero_enabled controls whether an idle served entity's compute scales down to zero, and it has no mechanism for throttling a fixed percentage of traffic based on a comment field.
4.Validate, deploy, run, destroy
The Databricks CLI runs a bundle through the same four commands in every environment. databricks bundle validate checks the configuration and warns about resource properties it does not recognise. databricks bundle deploy -t <target> sends the resources and artifacts to that target's workspace and leaves other targets alone. After deployment, jobs run on their own schedules. databricks bundle run -t <target> <job-name> starts a job immediately, for example an MLOps Stacks model_training_job. databricks bundle destroy -t <target> removes what was deployed, after asking you to confirm. If you leave out -t, the CLI uses the default target, so deploying to any other target requires the flag.
# You must specify "-t prod", because the "dev" target
# is already set to "default: true":
databricks bundle validate
databricks bundle deploy -t prod
databricks bundle run -t prod hello_jobCheckpoint 7 of 7· Put it in order
Put the bundle commands for a first release to a target in order
- 1.databricks bundle validate
- 2.databricks bundle run -t <target-name> <job-name>
- 3.databricks bundle deploy -t <target-name>
Validation catches configuration errors before anything reaches the workspace, deploy creates the resources, and run can only start a job that has already been deployed.
“Finally, validate and deploy your bundle, then run your workflows.”Source: docs.databricks.com
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.A bundle's model serving endpoint lists its models under served_models.Why is that wrong?
served_entities is the current field. served_models is deprecated.
Covered in Declaring experiments, registered models and serving endpoints
2.To change one setting in prod, you must repeat the whole resource definition inside the prod target.Why is that wrong?
A target only needs the fields it changes. Everything else comes from the top-level resources mapping.
Covered in Targets: one definition, many environments
Practise it for real
Create an MLOps Stacks bundle, deploy it to a dev target, run its training job, and clean up
1.Run
databricks bundle init mlops-stacksand choose CICD_and_Project at the first promptWhy: This creates both the ML code and the CI/CD components, so you can see the full project structure
You should see: Starter files for the project, including databricks.yml, appear in your working directory
2.From the project root, run
databricks bundle validateWhy: This catches configuration errors and unknown resource properties before anything is deployed
You should see: A summary of the bundle configuration. If errors appear, fix them and validate again
3.Run
databricks bundle deploy -t devWhy: This deploys the resources and artifacts to the dev target only, leaving staging and prod untouched
You should see: The project's jobs and other resources are created in the dev workspace and will run on their schedules
4.Run
databricks bundle run -t dev model_training_jobWhy: This starts training now instead of waiting for the next scheduled run
You should see: The CLI prints a link to the job run in the Databricks UI
5.Run
databricks bundle destroy -t devand confirm when promptedWhy: This removes the resources and artifacts the dev deployment created
You should see: After you confirm, the deployed resources are deleted from the dev workspace
Stuck? Get a nudge
If the deploy command fails to authenticate, run databricks auth login --host <workspace-url> first and check that the target's host matches a profile in your configuration.
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
“Definitions and settings for Databricks resources, such as Lakeflow Jobs, Lakeflow pipelines, Dashboards, Model Serving endpoints, MLflow Experiments, and MLflow registered models”
↩︎ The anatomy of a bundle“Finally, validate and deploy your bundle, then run your workflows.”
↩︎ Checkpoint - 2.
“A bundle must contain one (and only one) configuration file named databricks.yml at the root of the bundle project folder.”
↩︎ The anatomy of a bundle“it falls back to use the notebook_task mapping within the top-level resources mapping”
↩︎ Targets: one definition, many environments“it falls back to use the notebook_task mapping within the top-level resources mapping”
↩︎ Exam trap 2“<defined-variable-name>: <non-default-value> # value for this target”
↩︎ Checkpoint - 3.
“the mappings within an experiment declaration correspond to the create experiment operation's request payload”
↩︎ Declaring experiments, registered models and serving endpoints“The project's deployed jobs automatically run on their predefined schedules.”
↩︎ Validate, deploy, run, destroy - 4.
“Each served entity contains fields like entity_name, entity_version, workload_size, scale_to_zero_enabled, workload_type, environment_vars.”
↩︎ Declaring experiments, registered models and serving endpoints“The databricks bundle validate command returns warnings if unknown resource properties are found in bundle configuration files.”
↩︎ Validate, deploy, run, destroy“(Deprecated: use served_entities instead) A list of served models for the endpoint to serve.”
↩︎ Exam trap 1“registered_model (Unity Catalog) | Registered model object”
↩︎ Prediction - 5.
“Prepends all resources that are not deployed as files or notebooks with the prefix [dev ${workspace.current_user.short_name}]”
↩︎ Targets: one definition, many environments