databricksdbutils

How to get Databricks Instance ID programatically?


Is there any possibility to retrieve Databricks Instance Id (the blurred piece of URL) by executing some code in the notebook cell?

enter image description here


Solution

  • for notebooks, you can get context of the notebooks via dbutils with code like this (in Python, for example):

    dbutils.notebook.entry_point.getDbutils().notebook() \
      .getContext().tags().get("browserHostName").get()
    

    Then you can parse URL to using regex