Need Help?

Search our documentation and community forum

Terra is a cloud-native platform for biomedical researchers to access data, run analysis tools, and collaborate.
Terra powers important scientific projects like FireCloud, AnVIL, and BioData Catalyst. Learn more.

Is there a way to find which workspace owns a bucket?



  • Avatar

    I realized I could extract this information from the API so I wrote a script to dump everything that I can see. I have some logistics to sort out as I'll need to get my collaborator to run this with their account, however, I'm hopeful this will unblock us.

    It would be very convenient if Terra used google's bucket label to store a label on the bucket of the owning workspace -- but absent something like that, I think this is the best solution I can come up with.

    I'm posting my code here in case it's helpful for someone else faced with the same challenge in the future:


    import subprocess
    import requests
    import pandas as pd

    token = subprocess.check_output(["gcloud","auth","print-access-token"]).decode("utf8").strip()
    response = requests.get("", headers={"accept": "application/json", "Authorization": "Bearer "+token})

    workspaces = response.json()
    private_workspaces = [w for w in workspaces if not w['public']]
    bucketName = [w['workspace']['bucketName'] for w in private_workspaces]
    workspace = [w['workspace']['namespace'] +"/"+ w['workspace']['name'] for w in private_workspaces]

    terra_workspaces = pd.DataFrame(dict(workspace=workspace, bucketName=bucketName))
    Comment actions Permalink
  • Avatar
    Samantha Velasquez

    Hi pmontgom,


    I'm glad you were able to extract the information you were looking for with your script. I have created a ticket with your suggestion for our engineering team to look into.




    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk