• Login
Wednesday, June 18, 2025
The Cloud Guru
  • Home
  • AWS
  • Data Center
  • GCP
  • Technology
  • Tutorials
  • Blog
    • Blog
    • Reviews
No Result
View All Result
Wednesday, June 18, 2025
  • Home
  • AWS
  • Data Center
  • GCP
  • Technology
  • Tutorials
  • Blog
    • Blog
    • Reviews
No Result
View All Result
No Result
View All Result

Setting Up Cost Control with Quota

Team TCG by Team TCG
December 21, 2024
in GCP, Tutorials
0 0
0
Home GCP
0
SHARES
11
VIEWS
Share on FacebookShare on Twitter

In this lab you will complete the following tasks:

  • Queried a public dataset and explore associated costs.
  • Modified BigQuery API quota.
  • Tried to rerun the query after quota had been modified.

Activate Cloud Shell

Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.

  1. Click Activate Cloud Shell Activate Cloud Shell icon at the top of the Google Cloud console.

When you are connected, you are already authenticated, and the project is set to your PROJECT_ID. The output contains a line that declares the PROJECT_ID for this session: Your Cloud Platform project in this session is set to YOUR_PROJECT_ID

gcloud is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab completion.

  1. (Optional) You can list the active account name with this command:

gcloud auth list

  1. Click Authorize.

Open the BigQuery console

  1. In the Google Cloud Console, select Navigation menu > BigQuery.

The Welcome to BigQuery in the Cloud Console message box opens. This message box links the quickstart guide and the release notes.

  1. Click Done.

The BigQuery console opens.

Task 1. Query a public dataset in BigQuery

In this lab, you query the bigquery-public-data:wise_all_sky_data_release public dataset. Learn more about this dataset from the blog post Querying the Stars with BigQuery GIS.

  1. In the Query editor paste the following query:SELECT w1mpro_ep, mjd, load_id, frame_id FROM `bigquery-public-data.wise_all_sky_data_release.mep_wise` ORDER BY mjd ASC LIMIT 500
  2. Do not run the query. Instead, please answer the following question:

Use the query validator to determine how many bytes of data this will process when you run.

  1. Now run the query and see how quickly BigQuery processes that size of data.

Task 2. Explore query cost

The first 1 TB of query data processed per month is free.

  • Learn more about cost from the BigQuery pricing guide.
  • For more information on calculating and estimating costs in Google Cloud, use the Google Cloud Pricing Calculator.

Task 3. Update BigQuery quota

In this task, you update the BigQuery API quota to restrict the data processed in queries in your project.

  1. In your Cloud Shell, run this command to view your current usage quotas with the BigQuery API:

gcloud alpha services quota list –service=bigquery.googleapis.com –consumer=projects/${DEVSHELL_PROJECT_ID} –filter=”usage”

The consumerQuotaLimits display your current query per day limits. There is a separate quota for usage per project and usage per user.

  1. Run this command in Cloud Shell to update your per user quota to .25 TiB per day:

gcloud alpha services quota update –consumer=projects/${DEVSHELL_PROJECT_ID} –service bigquery.googleapis.com –metric bigquery.googleapis.com/quota/query/usage –value 262144 –unit 1/d/{project}/{user} –force

  1. After the quota is updated, examine your consumerQuotaLimits again:

gcloud alpha services quota list –service=bigquery.googleapis.com –consumer=projects/${DEVSHELL_PROJECT_ID} –filter=”usage”

You should see the same limits from before but also a consumerOverride with the value used in the previous step:— consumerQuotaLimits: – metric: bigquery.googleapis.com/quota/query/usage quotaBuckets: – defaultLimit: ‘9223372036854775807’ effectiveLimit: ‘9223372036854775807’ unit: 1/d/{project} – metric: bigquery.googleapis.com/quota/query/usage quotaBuckets: – consumerOverride: name:projects/33699896259/services/bigquery.googleapis.com/consumerQuotaMetrics/bigquery.googleapis.com%2Fquota%2Fquery%2Fusage/limits/%2Fd%2Fproject%2Fuser/consumerOverrides/Cg1RdW90YU92ZXJyaWRl overrideValue: ‘262144’ defaultLimit: ‘9223372036854775807’ effectiveLimit: ‘262144’ unit: 1/d/{project}/{user} displayName: Query usage metric: bigquery.googleapis.com/quota/query/usage unit: MiBy

Next, you will re-run your query with the updated quota.

Task 4. Rerun your query

  1. In the Cloud Console, click BigQuery.
  2. The query you previously ran should still be in the query editor, but if it isn’t, paste the following query in the Query editor and click Run: SELECT w1mpro_ep, mjd, load_id, frame_id FROM `bigquery-public-data.wise_all_sky_data_release.mep_wise` ORDER BY mjd ASC LIMIT 500
  3. Note the validator still mentions This query will process 1.36 TB when run. However, the query has run successfully and hasn’t processed any data. Why do you think that is?

Running the same query again may not process any data because of the automatic query, Caching feature in BigQuery.ShufflingJoiningcheck

Note: If your query is already blocked by your custom quota, don’t worry. It’s likely that you set the custom quota and re-run the query before the first query had time to cache the results.

Queries that use cached query results are at no additional charge and do not count against your quota. For more information on using cached query results, see Using cached query results.

In order for us to test the newly set quota, you must to disable query cache to process data using the previous query.

  1. To test that the quota has changed, disable the cached query results. In the Query results pane, click More > Query settings:
Query settings option highlighted in the More dropdown mnenu
  1. Uncheck Use cached results and click Save.
  2. Run the query again so that it counts against your daily quota.
  3. Once the query has run successfully and processed the 1.36 TB, run the query once more.What happened? Were you able to run the query? You should have received an error like the following:Custom quota exceeded: Your usage exceeded the custom quota for QueryUsagePerUserPerDay, which is set by your administrator. For more information, see https://cloud.google.com/bigquery/cost-controls

Task 5. Explore BigQuery best practices

Quotas can be used for cost controls but it’s up to your business to determine which quotas make sense for your team. This is one example of how to set quotas to protect from unexpected costs. One way to reduce the amount of data queried is to optimize your queries.

Learn more about optimizing BigQuery queries from the Control costs in BigQuery guide.

And just like that you completed all the tasks! Congrats..

Tags: BigQueryCloud ComputingGCPHow toTutorials
Previous Post

Distributed Load Testing Using Kubernetes

Next Post

Setup Cloud Monitoring on GCP

Team TCG

Team TCG

Related Posts

Driving Success with Google Cloud: Real-World Hybrid and Multi-Cloud Case Studies

Hybrid and multi-cloud adoption has become the new norm for enterprises seeking to harness the power of cloud computing while...

by thecloudguru
November 28, 2023

Unleashing the Power of Google Cloud’s Hybrid and Multi-Cloud Solutions for Your Enterprise

In today's ever-evolving IT landscape, enterprises are seeking innovative solutions to harness the benefits of hybrid and multi-cloud environments. Google...

by thecloudguru
November 21, 2023

Mastering the Hybrid Cloud: Common Architecture Patterns and Implementation Strategies

The hybrid cloud has emerged as a dynamic solution for organizations seeking to balance flexibility, scalability, and control in their...

by thecloudguru
October 31, 2023
GCP

Setup Cloud Monitoring on GCP

Overview Cloud Monitoring provides visibility into the performance, uptime, and overall health of cloud-powered applications. Cloud Monitoring collects metrics, events,...

by Team TCG
October 1, 2023
GCP

Distributed Load Testing Using Kubernetes

Activate Cloud Shell Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB...

by Team TCG
October 1, 2023
GCP

Deploying Memcached on Kubernetes Engine

Overview In this lab, you'll learn how to deploy a cluster of distributed Memcached servers on Kubernetes Engine using Kubernetes, Helm, and Mcrouter. Memcached is one of...

by Team TCG
October 1, 2023
Next Post

Setup Cloud Monitoring on GCP

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Trending
  • Comments
  • Latest

Comparing AWS Storage Services: S3 vs. EBS vs. EFS vs. FSx vs. S3 Glacier vs. Storage Gateway

September 30, 2023

AWS DataSync vs. AWS Storage Gateway: Choosing the Right Data Transfer Service

September 30, 2023

Comparing AWS Compute Services: EC2 vs. ECS vs. EKS vs. Fargate vs. Lambda

September 30, 2023

How Duolingo’s AWS-Powered Language Learning Platform?

October 30, 2023

AWS SnowMobile

0

Passwordless Login Using SSH Keygen in 5 Easy Steps

0

Create a new swap partition on RHEL system

0

Configuring NTP using chrony

0

Azure Case Study: How Spotify Uses Azure

March 16, 2025

Quick Tip: Troubleshooting Common Azure Errors

March 15, 2025

Azure Cognitive Services: Adding AI Capabilities to Your Applications

March 15, 2025

Azure IoT Hub: Connecting IoT Devices to the Cloud

March 15, 2025

Recommended

Azure Case Study: How Spotify Uses Azure

March 16, 2025

Quick Tip: Troubleshooting Common Azure Errors

March 15, 2025

Azure Cognitive Services: Adding AI Capabilities to Your Applications

March 15, 2025

Azure IoT Hub: Connecting IoT Devices to the Cloud

March 15, 2025

About Us

Let's Simplify the cloud for everyone. Whether you are a technologist or a management guru, you will find something very interesting. We promise.

Categories

  • 2 Minute Tutorials (7)
  • AI (3)
  • Ansible (1)
  • Architecture (3)
  • Artificial Intelligence (3)
  • AWS (168)
  • Azure (3)
  • books (2)
  • Consolidation (4)
  • Containers (1)
  • Data Analytics (1)
  • Data Center (11)
  • Design (1)
  • GCP (13)
  • HOW To's (17)
  • Innovation (1)
  • Kubernetes (8)
  • LifeStyle (2)
  • LINUX (6)
  • Microsoft (2)
  • news (3)
  • People (4)
  • Reviews (1)
  • RHEL (2)
  • Security (2)
  • Self-Improvement and Professional Development (1)
  • Serverless (2)
  • Social (2)
  • Switch (1)
  • Technology (133)
  • Terraform (3)
  • Tools (1)
  • Tutorials (13)
  • Uncategorized (8)
  • Video (1)
  • Videos (1)

Tags

2Min's (7) Agile (1) AI (5) Appication Modernization (1) Application modernization (1) Architecture (1) AWS (43) AZURE (4) BigQuery (1) books (2) Case Studies (17) CI/CD (1) Cloud Computing (185) Cloud Optimization (1) Comparo (17) Consolidation (1) Courses (1) Data Analytics (1) Data Center (8) Emerging (1) GCP (11) Generative AI (1) How to (14) Hybrid Cloud (5) Innovation (2) Kubernetes (4) LINUX (5) lunch&learn (133) memcache (1) Microsoft (1) monitoring (1) NEWS (2) NSX (1) Opinion (3) SDDC (2) security (1) Self help (2) Shorties (1) Stories (1) Team Building (1) Technology (3) Tutorials (20) vmware (3) vSAN (1) Weekend Long Read (1)
  • About
  • Advertise
  • Privacy & Policy

© 2023 The Cloud Guru - Let's Simplify !!

No Result
View All Result
  • Home
  • AWS
  • HOW To’s
  • Tutorials
  • GCP
  • 2 Minute Tutorials
  • Data Center
  • Artificial Intelligence
  • Azure
  • Videos
  • Innovation

© 2023 The Cloud Guru - Let's Simplify !!

Welcome Back!

Sign In with Facebook
Sign In with Google
Sign In with Linked In
OR

Login to your account below

Forgotten Password?

Create New Account!

Sign Up with Facebook
Sign Up with Google
Sign Up with Linked In
OR

Fill the forms bellow to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In