What you will be able to do
- Structure a databricks.yml with a resources mapping and per-environment targets
- Declare MLflow experiments, Unity Catalog registered models and model serving endpoints in a bundle
- Configure served_entities and traffic_config to serve a specific model version or split traffic
- Run validate, deploy, run and destroy against a chosen target
1.databricks.yml, resources and targets
A Databricks Asset Bundle (DAB) is a set of source files that defines a whole project, including how it gets tested and deployed. Databricks now calls these Declarative Automation Bundles. Every bundle has exactly one configuration file named databricks.yml at the root of the project folder. It can pull in other YAML files through include, which keeps each resource in its own file. The minimum it needs is a bundle name and a target.
Two top-level mappings do most of the work. resources declares the Databricks objects the bundle owns, such as jobs, experiments, registered models and serving endpoints. targets names each place the bundle deploys to, such as dev, staging and prod. Exactly one target can have default: true. Other top-level keys include variables, workspace, permissions, run_as, artifacts, sync and include. A CI pipeline usually sets run_as to a service principal.
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-fabcd456A target only lists what differs. The prod target above replaces the cluster ID, and any mapping it leaves out, such as the notebook_task, falls back to the top-level resources definition. That merge is how one shared resource gets different settings per environment. For example, a serving endpoint can be Small in dev and Medium in prod: either override the field under targets.<name>.resources, or declare a custom variable under variables and give it a different value under targets.<name>.variables. Setting workspace.host on each target is recommended over relying on default, because it makes the configuration portable. The CLI picks the matching profile from .databrickscfg.
Checkpoint 1 of 8· Fill the gap
This targets block points the prod target at the production workspace. Databricks recommends this field over relying on default, because the CLI uses it to find the matching profile in .databrickscfg. Which key fills the blank?
targets:
dev:
default: true
prod:
workspace:
? : https://<production-workspace-url>
resources:
jobs:
hello-job:
name: hello-job
tasks:
- task_key: hello-task
existing_cluster_id: 2345-678901-fabcd456Setting workspace.host on each target tells the Databricks CLI which workspace to deploy to. The CLI then finds the .databrickscfg profile with the same host, which makes the configuration portable.
Checkpoint 2 of 8· Check yourself
The top-level resources of a bundle defines hello-job with a notebook_task. The prod target above overrides only the job's existing_cluster_id. What happens when you run databricks bundle deploy -t prod?
A target lists only what differs from the top-level definition. Prod's cluster ID replaces the top-level one, and the notebook_task it leaves out falls back to the top-level definition, so one bundle serves every environment.
“it falls back to use the notebook_task mapping within the top-level resources mapping”Source: docs.databricks.com
Sources1
2.Experiments and registered models as resources
Each resource type maps to a Databricks REST API object, and its YAML keys are that object's create-request fields. An experiments entry follows the MLflow create-experiment payload. A registered_models entry follows the payload for creating a Unity Catalog model. The bundle validator warns about any key the schema doesn't recognise, so a typo shows up before deployment instead of being silently ignored.
| Asset | Key under resources | Fields that identify it |
|---|---|---|
| MLflow experiment | experiments | name (an absolute workspace path), artifact_location, permissions, tags |
| Unity Catalog model | registered_models | name, catalog_name, schema_name, grants, aliases |
| Real-time serving endpoint | model_serving_endpoints | name, config, tags |
An experiment name must be an absolute workspace path, such as /Workspace/Users/someone@example.com/my_experiment, not a bare label. A registered model is split into name, catalog_name and schema_name. Grants go on the resource itself, because bundles don't support a top-level grants mapping.
resources:
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 userscatalog_name: ${bundle.target} applies the catalog-per-environment layout. Deploying with -t dev creates the model in the dev catalog, and -t prod creates it in prod, all from one definition. The model resource type is the legacy Workspace Model Registry. Unity Catalog models use registered_models.
Checkpoint 3 of 8· Check yourself
Your team wants one bundle definition that creates the Unity Catalog model in the dev catalog when deployed with -t dev and in the prod catalog with -t prod. Which declaration does that?
Unity Catalog models are declared under registered_models, because the model key is the legacy Workspace Model Registry. Setting catalog_name to ${bundle.target} sends each deployment to its environment's catalog from a single definition. Grants belong on the resource itself, and you don't need a second bundle.
“registered_model (Unity Catalog) | Registered models | Registered model object”Source: docs.databricks.com
3.Model serving endpoints: served entities and traffic routes
A real-time endpoint for a Unity Catalog model goes under resources.model_serving_endpoints. The bundle schema has no serving_endpoints, model_endpoints or endpoints key. Inside the entry, config.served_entities lists what the endpoint serves. Each entity has fields such as entity_name, entity_version, workload_size, scale_to_zero_enabled, workload_type and environment_vars. entity_name takes the full three-level catalog.schema.model name, and entity_version takes the version number. To serve version 4 of prod.fraud.fraud_scorer, set those two fields to those values. Keys like name/version, model_name/alias or a separate catalog_schema aren't served-entity fields. The older served_models list is deprecated in favour of served_entities.
resources:
model_serving_endpoints:
uc_model_serving_endpoint:
name: 'uc-model-endpoint'
config:
served_entities:
- 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'
tags:
- key: 'team'
value: 'data science'traffic_config.routes controls where traffic goes. Each route pairs a served_model_name with a traffic_percentage. For a 90/10 canary, list two served entities, one per model version, and give their routes 90 and 10. A route refers to the served model's name, which is my-ads-model-10 in the example, not the three-level entity_name. workload_size and scale_to_zero_enabled only set compute capacity and don't affect routing. The same resource can also set email_notifications for update success or failure, and an AI Gateway inference_table_config that logs requests to Unity Catalog tables.
Checkpoint 4 of 8· Fill the gap
To serve version 10 of a Unity Catalog model from a bundle, the endpoint's config has to list what it serves. Which key belongs in the blank, based on the current bundle schema?
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'
tags:
- key: 'team'
value: 'data science'config.served_entities lists what the endpoint serves. Each entry names the model with entity_name (catalog.schema.model) and the version with entity_version. The older served_models list is deprecated in favour of served_entities.
Source: docs.databricks.comCheckpoint 5 of 8· 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.
Checkpoint 6 of 8· 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.
Checkpoint 7 of 8· 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.
Sources2
4.Validate, deploy, run and destroy against a target
Four CLI commands, all run from the folder that holds databricks.yml, cover the bundle lifecycle:
databricks bundle validatechecks the configuration and prints a summary if it is valid. Fix any errors it reports and run it again.databricks bundle deploy -t <target>deploys the resources and artifacts to that target's workspace.databricks bundle run -t <target> <job-name>starts a deployed job immediately. Deployed jobs also run on their own schedules.databricks bundle destroy -t <target>deletes the deployed resources and artifacts after a confirmation prompt.
databricks bundle validate
databricks bundle deploy -t prod
databricks bundle run -t prod hello_jobThe -t flag picks the target, so it decides which workspace and which overrides apply. Leave it out and the CLI uses the target marked default: true. To push a bundle tested in dev to staging, run databricks bundle deploy -t staging. That deploys the same definition with the staging target's settings, and the dev deployment stays as it was. One bundle should cover all of a project's environments instead of one bundle per environment. That way dev, staging and prod deploy from the same definition.
Checkpoint 8 of 8· Fill the gap
Validation has passed, and hello_job now has to go to the production workspace and then run there. The dev target is the default. Which bundle command fills the blank?
databricks bundle validate
databricks bundle ? -t prod
databricks bundle run -t prod hello_jobdatabricks bundle deploy -t prod sends the bundle's resources and artifacts to the prod target's workspace and applies that target's overrides. Only after that can bundle run -t prod start the deployed job. Because dev is the default target, both commands need -t prod.
Practise it for real
Create an MLOps Stacks project and take it through the full bundle lifecycle in a dev target.
1.Run databricks bundle init mlops-stacks and choose CICD_and_Project at the first prompt.
Why: This generates the ML code, bundle resources and CI/CD workflows in one go.
You should see: Starter files for the project appear in your current working directory.
2.From the folder that holds databricks.yml, run databricks bundle validate.
Why: It catches configuration errors and unknown resource keys before anything is deployed.
You should see: A summary of the bundle configuration. If you get errors instead, fix them and run it again.
3.Run databricks bundle deploy -t dev.
Why: This deploys the jobs and other resources to the dev target's workspace only.
You should see: The deployment completes, and the deployed jobs are set to run on their predefined schedules.
4.Run databricks bundle run -t dev model_training_job.
Why: This starts training immediately instead of waiting for the schedule.
You should see: A link to the Databricks job that you can open in the UI.
5.Run databricks bundle destroy -t dev and confirm the prompts.
Why: This removes what the dev deployment created once you're done with it.
You should see: The previously deployed resources and artifacts are deleted from the dev target.
Stuck? Get a nudge
If deploy can't authenticate, run databricks auth login --host with your workspace URL and accept the suggested profile.
Sources
(4)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“A bundle must contain one (and only one) configuration file named databricks.yml at the root of the bundle project folder.”
↩︎ databricks.yml, resources and targets“it falls back to use the notebook_task mapping within the top-level resources mapping”
↩︎ databricks.yml, resources and targets“Databricks recommends that you use the host mapping instead of the default mapping wherever possible, as this makes your bundle configuration files more portable.”
↩︎ databricks.yml, resources and targets“A bundle must contain one (and only one) configuration file named databricks.yml at the root of the bundle project folder.”
↩︎ Exam trap 2 - 2.
“The databricks bundle validate command returns warnings if unknown resource properties are found in bundle configuration files.”
↩︎ Experiments and registered models as resources“An experiment name must be an absolute path in the Databricks workspace”
↩︎ Experiments and registered models as resources“Each served entity contains fields like entity_name, entity_version, workload_size, scale_to_zero_enabled, workload_type, environment_vars.”
↩︎ Model serving endpoints: served entities and traffic routes“Each route contains served_model_name and traffic_percentage.”
↩︎ Model serving endpoints: served entities and traffic routes“Configuration for inference logging to Unity Catalog tables.”
↩︎ Model serving endpoints: served entities and traffic routes“(Deprecated: use served_entities instead) A list of served models for the endpoint to serve.”
↩︎ Exam trap 1“registered_model (Unity Catalog) | Registered models | Registered model object”
↩︎ Checkpoint“The traffic config defining how invocations to the serving endpoint should be routed.”
↩︎ Prediction - 3.
“For customizing models, the mappings within a model declaration correspond to the create Unity Catalog model operation's request payload”
↩︎ Experiments and registered models as resources“If a summary of the bundle configuration is returned, then the validation succeeded.”
↩︎ Validate, deploy, run and destroy against a target“The project's deployed jobs automatically run on their predefined schedules.”
↩︎ Validate, deploy, run and destroy against a target - 4.
“Each bundle should cover all environments for a given project (dev, staging, production) rather than using separate bundles per environment.”
↩︎ Validate, deploy, run and destroy against a target“Each bundle should cover all environments for a given project (dev, staging, production) rather than using separate bundles per environment.”
↩︎ Exam trap 3