MARK MIRCHANDANI: If you have a large team working
with your Google Cloud Platform resources,
you may want to make sure you set caps
on the amount of certain resources that can be used.
On this episode of "Beyond Your Bill,"
we'll talk about what quotas are and how to set them up.
[MUSIC PLAYING]
Budgets allow you to trigger notifications
so that you know how your actual and forecasted costs are
trending over time and prompt you to take action if needed.
Quotas allow you to set your own capped limit
to the number of concurrent resources in a project
or the number of API requests.
Quotas are important to protect the community of GCP users
and safeguard against unforeseen spikes
in usage that could lead to budget overruns.
There are two types of quotas--
allocation quota that measures that a resource,
like the number of virtual machines
you can have spun up at once, and rate quotas
that reset after a certain amount of time,
like API requests per minute.
Most resources and APIs in each project
have quotas set by default, and some can even be unlimited.
But you can also configure specific quotas
to help manage your cloud resources
and establish cost controls.
For example, let's say you have a test environment where
a lot of users have access to BigQuery.
Since it is a test environment, people
may be a little less careful about optimizing
their queries, which may result in some costly mistakes.
So you may want to set up in a quota limit
to ensure that each user can only
query a certain amount of data every day.
Let's check out how to view your current quota limits
and how to modify an existing quota limit.
In the GCP console, you can use the top left navigation
to select Quotas under IAM and Admin.
Since quotas are set per project,
you may need to choose a project if you haven't selected one
already.
You'll also need to have the right permissions
for the project, such as project owner or editor,
in order to change any quota limits.
The Quotas page contains a large number
of quotas across all the GCP products and services
available to you.
There is a lot here, so you can use
the filters to narrow down the quotas you're interested in.
Filtering by type lets you choose between unlimited quotas
or quotas with usage.
Service, metric, and location filter down
to just quotas matching what you select.
For our example, we'll start by filtering to just BigQuery
to keep the list manageable.
You can click on the drop-down by Service,
click on None to deselect everything,
and then click on BigQuery API.
Now we're just looking at BigQuery related quotas.
Each row is a different quota and you
can click on a quota to go to the API specific quota
page, which may show graphs or other details.
On our current project-wide quota page,
each row starts with a description
of the quota, then the location or regions
that the quota affects.
After that, the current usage and peak usage
over the past seven days is shown.
For allocation quotas, the current usage
is how much of the resource is currently in use,
while for rate quotas, it's the usage
so far in the current day.
The last column is the actual limit enforced by the quota.
The first row item, Query Usage Per Day, shows us how much data
we've queried today in BigQuery and that there's currently
no limit set up.
If we edited this quota, we could set a limit
on the amount of data that could be queried
for day for the entire project.
For our example, we want to limit each user on the project.
So let's select the Query Usage Per Day Per User quota instead.
We'll select the check box and then hit Edit Quotas
at the top of the page.
It's also possible to edit multiple quotas at once.
On the right side of the console,
a form will open up where we can input our limit.
Some edits may require you to fill out
contact information and a form to request the limit
update rather than modifying the limit directly.
Quota requests are typically handled within two business
days and an email confirmation is sent out
once the requested update has been reviewed.
For this quota, we can easily lower it from unlimited
to any number we want without needing to make a request.
Let's limit each user to half a tebibyte
of data queried since that's the metric that BigQuery checks
for quotas and for pricing.
With a quota limit set, there will now
be a limit for each user when running queries.
One important note is that the Quota page doesn't show you
the current usage for every quota,
such as the per user quota that we just edited.
Check out the link in the description
to see more about setting up monitoring for quotas.
To test out our limit, we can run a query in BigQuery
that is projected to process much more data than is allowed
by our limit.
BigQuery returns back this error showing us the quota
has been exceeded, so the query won't run.
We can also run smaller queries up
until our quota limit, at which point
we can't run any more until the next day.
You can set the quota limits that best
match your desired usage caps across many
of the GCP services.
It's also possible to set up monitoring
for quota metrics in Stackdriver so that you can create
custom dashboards or alerts.
Check out the Monitoring Quota Metrics link below
to see how to set this up.
Now you should be able to view your existing quotas
and update quota limits to protect against surprises.
Check out the links for more information
on working with quotas.
[MUSIC PLAYING]