DEV Community

Cover image for Understanding Google Cloud Platform Pricing | AI/ML Pricing on Google Cloud Platform
Kemal Cholovich
Kemal Cholovich

Posted on

Understanding Google Cloud Platform Pricing | AI/ML Pricing on Google Cloud Platform

Understanding Google Cloud Platform Pricing

As a GDG Community Leader, I've often been asked about the intricacies of Google Cloud Platform (GCP) pricing. Navigating through the various pricing models can be a bit overwhelming, but with a clear understanding, you can optimize costs effectively. Let's dive into the different pricing points with some examples to make things clearer.

Pricing Overview

GCP pricing is based on the resources you consume, which include compute, storage, and networking. Costs can vary depending on the type of services you use, the region where your resources are located, and how you use them.

Free Trial and Free Tier

Free Trial:
New GCP users receive $300 in free credits to use over 90 days. This allows you to experiment with most GCP services without incurring any costs.

Free Tier:
Certain GCP services offer free usage limits every month. For example:

  • Compute Engine: 1 f1-micro VM instance per month in specific regions.
  • Cloud Storage: 5 GB of regional storage.
  • BigQuery: 1 TB of queries per month.

On Demand

This is the pay-as-you-go model, where you only pay for the resources you use without any long-term commitments.

Example:
If you run an n1-standard-1 VM in the us-central1 region for 10 hours at an hourly rate of $0.0475, the cost would be:

  • 10 hours * $0.0475/hour = $0.475

Committed Use Discounts

By committing to use certain resources for 1 or 3 years, you can save significantly compared to on-demand pricing. This requires an upfront commitment.

Example:
If the on-demand cost for an n1-standard-1 VM is $0.0475 per hour, a 1-year committed use discount might reduce it to $0.033 per hour.

  • Annual cost: 8760 hours * $0.033/hour = $288.08 (compared to $415.50 on-demand).

Sustained Use Discounts - I love it!

These discounts are automatically applied when you use certain resources consistently for a significant portion of the month. The more you use, the higher the discount.

Example:
If you run a VM for more than 25% of the month, GCP will automatically apply a discount to your usage for the entire month. The discount increases as your usage approaches 100%.

Flat Rate Pricing

For services like BigQuery, you can opt for flat-rate pricing, which offers predictable pricing by charging a fixed monthly fee regardless of actual usage.

Example:
BigQuery's flat-rate pricing option allows you to pay a fixed fee (e.g., $10,000 per month) for a dedicated slot of processing capacity, making it ideal for organizations with high and predictable query loads.

Sole Tenant Node Pricing

This model is ideal for organizations that require dedicated physical servers due to regulatory, compliance, or performance needs. You pay for the exclusive use of a physical server, which can run multiple virtual machines.

Example:
Suppose a sole tenant node costs $1,000 per month. You can run multiple VMs on this node, and the total cost remains $1,000, providing dedicated hardware and isolation for your workloads.

Banking Example with Sole Tenant Nodes

Let's say you're a bank that needs to run sensitive financial applications requiring strict compliance and data isolation. By using sole tenant nodes, you ensure that your data and applications run on dedicated hardware without sharing resources with other customers. This isolation helps meet regulatory requirements and enhances security.

Example:
If your bank runs several critical applications on a sole tenant node costing $2,000 per month, you can ensure these applications are isolated, reducing the risk of data breaches. Additionally, you can run multiple virtual machines on this dedicated node, optimizing the use of the physical hardware while maintaining compliance.

AI/ML Pricing on Google Cloud Platform

Google Cloud Platform (GCP) offers a range of AI and ML services designed to help you build, deploy, and scale your AI solutions. The pricing for these services varies based on usage and the specific service you are using. Let's break down the pricing for some commonly used AI and ML services on GCP with examples.

1. AI Platform Training and Prediction

AI Platform Training allows you to train machine learning models at scale. The cost depends on the type of machine (e.g., standard, high-memory, high-CPU, GPU) and the region where the training is performed.

Example:

  • If you use a n1-standard-4 VM (4 vCPUs, 15 GB memory) for training in the us-central1 region, and the hourly rate is $0.15, training for 10 hours would cost:
    • 10 hours * $0.15/hour = $1.50
  • If you add a Tesla K80 GPU, which costs $0.45 per hour, the total cost for 10 hours would be:
    • 10 hours * ($0.15 $0.45) = $6.00

AI Platform Prediction allows you to deploy trained models for making predictions. The cost is based on the number of predictions and the type of model deployed.

Example:

  • Suppose you deploy a model on a n1-standard-2 VM, which costs $0.10 per hour, and you use it for 100 hours:
    • 100 hours * $0.10/hour = $10.00
  • If you make 1 million predictions, and the cost per prediction is $0.0001, the total cost for predictions would be:
    • 1,000,000 predictions * $0.0001/prediction = $100.00

2. BigQuery ML

BigQuery ML enables you to create and execute machine learning models directly in BigQuery using SQL.

Example:

  • If you create a linear regression model on a dataset that has 10 million rows, and it takes 50 GB of processed data, the cost would be based on BigQuery's on-demand pricing.
  • Assuming the cost is $5 per TB of processed data:
    • (50 GB / 1024) * $5 = $0.24

3. AutoML

AutoML allows you to build custom machine learning models with minimal expertise. Pricing is based on the training hours and the prediction requests.

Example:

  • Training an image classification model for 10 hours on a n1-standard-8 VM with a Tesla P100 GPU, where the VM costs $0.50 per hour and the GPU costs $1.50 per hour:
    • 10 hours * ($0.50 $1.50) = $20.00
  • Making 1,000 predictions with the trained model at $0.0005 per prediction:
    • 1,000 predictions * $0.0005/prediction = $0.50

4. Dialogflow

Dialogflow is used for building conversational interfaces like chatbots. The pricing is based on the number of requests and the edition used (Standard or Enterprise).

Example:

  • Using Dialogflow Essentials (Standard edition) for 10,000 requests per month, where the first 1,000 requests are free, and each additional request costs $0.002:
    • (10,000 - 1,000) * $0.002 = $18.00

5. Cloud Vision API

Cloud Vision API enables image analysis and detection of objects, faces, text, and more. The pricing is based on the number of images processed.

Example:

  • Processing 1,000 images per month, with the first 1,000 units free, and additional units costing $1.50 per 1,000 units:
    • 1,000 images * $0.0015 = $1.50 (if exceeding free tier)

6. Cloud Natural Language API

This service is used for analyzing and extracting insights from text. Pricing is based on the number of text units processed.

Example:

  • Analyzing 500,000 text units per month, where the first 5,000 units are free, and additional units cost $0.0001 each:
    • (500,000 - 5,000) * $0.0001 = $49.50

Let's verify the provided statements about Vertex AI pricing based on the most recent and accurate information available online:

7. Vertex AI

Vertex AI is Google's unified AI platform that helps you build, deploy, and scale ML models. Pricing is based on the training and deployment resources you use.

Example:

  • Training a model: Suppose you need to train a machine learning model using Vertex AI. You use an n1-standard-8 VM (8 vCPUs, 30 GB memory) and a Tesla T4 GPU. The VM costs $0.379 per hour, and the GPU costs $0.35 per hour.

    • Training time: 10 hours
    • Cost calculation: 10 hours * ($0.379 $0.35) = $7.29
  • Data involved: Let's assume your training dataset is 100 GB. If your data is stored in Google Cloud Storage and you access it during training, you might incur additional storage costs. The cost for standard storage in the multi-region (us) is $0.026 per GB per month.

    • Storage cost: 100 GB * $0.026/GB/month = $2.60 per month
  • Deploying the model for online prediction: You deploy the trained model on a n1-standard-4 VM (4 vCPUs, 15 GB memory) for making online predictions. The VM costs $0.19 per hour.

    • Deployment time: 100 hours
    • Cost calculation: 100 hours * $0.19/hour = $19.00
  • Data involved: Suppose you serve predictions for 10,000 data points, each 1 KB in size.

    • Data transferred: 10,000 * 1 KB = 10 MB
    • If you need to move this data out of the GCP region, additional network egress charges might apply, typically around $0.12 per GB for the first 10 TB.

8. Vertex AI GenAI Models

Vertex AI GenAI Models offer pre-trained generative AI models that you can use directly or fine-tune for your specific needs. Pricing is based on the number of requests and the complexity of the model.

Example:

  • Using a GenAI text generation model: You utilize a pre-trained text generation model for generating 50,000 text responses. Each request costs $0.002.

    • Cost calculation: 50,000 requests * $0.002/request = $100.00
  • Data involved: Suppose each text response generated is about 2 KB.

    • Total data generated: 50,000 requests * 2 KB = 100,000 KB = 100 MB
  • Fine-tuning the model: If you fine-tune the model with an additional 10 GB of training data, and you use a similar n1-standard-8 VM with a Tesla T4 GPU for 20 hours, the cost would be:

    • Fine-tuning cost: 20 hours * ($0.379 $0.35) = $14.58
    • Storage cost for 10 GB: 10 GB * $0.026/GB/month = $0.26 per month

9. Vertex AI Agent Builder

Vertex AI Agent Builder helps you create and manage AI agents (e.g., chatbots). Pricing depends on the number of agents, the complexity of the interactions, and the compute resources used.

Example:

  • Creating an AI agent: You develop an AI chatbot that handles 20,000 interactions per month. Each interaction costs $0.001.

    • Cost calculation: 20,000 interactions * $0.001/interaction = $20.00
  • Data involved: Suppose each interaction involves 1 KB of data.

    • Total data processed: 20,000 interactions * 1 KB = 20 MB
  • Additional compute resources: If your chatbot needs to handle complex interactions requiring more processing power, you might use a n1-standard-4 VM (4 vCPUs, 15 GB memory) costing $0.19 per hour for an additional 50 hours.

    • Additional compute cost: 50 hours * $0.19/hour = $9.50
  • Data storage: If your chatbot logs interaction data amounting to 5 GB per month, the storage cost would be:

    • Storage cost: 5 GB * $0.026/GB/month = $0.13 per month

Important to know!

  • Vertex AI costs are based on the type of VM and GPU used, along with the duration of use.
  • Vertex AI GenAI Models costs are calculated per request and additional fine-tuning costs.
  • Vertex AI Agent Builder costs are based on interactions and additional compute resources needed.

Conclusion

For more detailed calculations and to stay updated on any pricing changes, I highly recommend using the GCP pricing calculator. It's a valuable tool to estimate costs based on your specific usage and requirements, and prices can change frequently, so it's good to check it regularly.

As you explore GCP, understanding these pricing models can help you make informed decisions, optimize costs, and leverage the full potential of Google Cloud's services.

Happy Clouding,
Kemal Cholovich

Top comments (1)

Collapse
 
axorax profile image
Axorax

If somone mentioned the term "GCP" i would probably assume it was something to do with the economy like GDP. Anyways, great article!