google-cloud-platformgoogle-bigquerycost-management

Is there a way in BigQuery to limit maximum amount of billed bytes (maximumBytesBilled) for all queries from specific service account?


BigQuery provides an option to limit amount of billed bytes on query level as described here: https://cloud.google.com/bigquery/docs/best-practices-costs#restrict-bytes-billed

Is there a way to set this limit on service account level, so it will be automatically applied to all queries coming from particular service account.

I have also checked available quotas, but there is no relevant options here.


Solution

  • No, it's not possible.

    You can set a quota per day and per account. But you can't set for a specific (service) account or per query.

    If you want to achieve that, you have to create a proxy/wrapper (with Cloud Run for example), that perform a dry run query and check the account and byte billed with your custom rules. If the rules are OK, the query can be ran