Google Cloud Run is a popular platform for hosting applications, but its pricing structure can be confusing. This article breaks down Google Cloud Run's pricing into monthly sums, making it easier to understand and compare against other services.
How Google Cloud Run Pricing Works
Cloud Run is a managed container service (PaaS) that runs your code in a container on Google-managed servers. You are billed based on the server resources consumed while your container is running.
- You can configure several aspects of how Cloud Run runs your container, including server size, the number of servers, and scaling behavior (horizontal and vertical scaling).
CPU Allocation Types
There are two primary CPU allocation types that affect pricing:
- Always Allocated: The server is always running your code, similar to a VPS or Google Compute Engine instance. The code is constantly active on the server.
- On Demand: The server only runs your code when a request is received. This is suitable for small applications but has potential cost tradeoffs, especially with high traffic.
The total monthly cost depends on the resources you use throughout the month based on these settings.
Key Factors Affecting Cloud Run Pricing
Google Cloud Run pricing depends on several factors.
-
Cloud Run Allocation Type: Whether you use Always Allocated or On Demand.
-
Server Size: The virtual CPUs and memory (RAM) allocated to your container.
-
Region: Cloud Run has regional price tiers, with prices varying significantly based on the region where your server is running.
Regional Price Tiers
It's crucial to understand the regional price tiers, as they greatly impact costs. These tiers are specific to Cloud Run and don't necessarily align with other Google Cloud product tiers. It's best to check the Cloud Run pricing page for accurate information about the current tier of a specific region.
-
Tier 2 regions tend to be more expensive than Tier 1 regions.
-
Always Allocated is cheaper per second than On Demand.
-
If your application receives few requests, then On Demand might still be cheaper.
Calculating Monthly Cloud Run Prices
To determine monthly Cloud Run costs, let's make a few simplifying assumptions.
Assumptions for Calculation
-
No Free Tier: We're ignoring the free tier because it's easily exceeded with a basic application. For most use cases with multiple apps, full pricing applies.
-
Free Requests and Transfer Payloads: Calculating these is complex, so we're assuming they're free. Consider the results as a baseline and expect potential additional costs with heavy request traffic.
-
Full Month Usage: We assume the server runs for the entire month (approximately 2.6 million seconds, or 30.5 days) for easier comparison with other services.
Monthly Price Estimates
A spreadsheet was created to calculate these monthly costs using the above assumption, showing expected monthly pricing in different configurations. These configurations can be configured in the cloud run portal.
-
Tier 1
-
Small instances could cost $50 - $65
-
Larger instances could cost up to $115 - $150 (on demand)
-
-
Tier 2
-
Small instances could cost $60 - $90
-
Large instances could cost up to $137 - $211 (on demand)
-
Important Takeaways:
-
On Demand Caution: If your server runs for a significant portion of the month, Always Allocated is likely more cost-effective, offering potential savings of 20-30%.
-
Tier 2 Expense: Tier 2 regions can significantly increase costs compared to Tier 1 regions.
It's generally recommended to use a Tier 1 region unless there are specific legal or operational reasons to be in Tier 2.
Surprising Pricing Insights
The monthly pricing results are somewhat surprising. While Cloud Run can be very affordable for small, low-traffic side projects (sometimes costing only a dollar a month), the pricing dynamics shift considerably for applications requiring an Always Allocated server.
Compared to VPS providers offering plans as low as $5 per month, Cloud Run's entry-level Always Allocated options (around $50 per month) can be significantly more expensive.