AWS Knowledge
Understanding Google Cloud Run Pricing and Costs
Piyush Kalra
Dec 2, 2024
The new trend in clouding services around the world revolves around competitiveness in speed, adaptability, and economic sustainability. Google Cloud offers countless tools for all organizations to assist in streamlining processes and enhancing creativity. Google Cloud Run, a fully managed, serverless platform that enables developers to handle containerized applications effortlessly, is among the most powerful.
Although powerful, mastering Google Cloud Run pricing models has been a headache for many. As a developer, owner of a startup or in charge of cloud infrastructure, understanding Cloud Run pricing will play a key role in ensuring expenses remain reasonable and the set budget is not overshot.
How to optimize your spending experience, as well as plenty of other details will be explored in this write-up, saving you time and money (20%, to be precise!). Let's begin, as it would take too many prompts to cover it all.
What is Google Cloud Run?
Google Cloud Run is a serverless solution that allows businesses to deploy containerized applications without engaging in operations. Such a solution provides flexibility and reliability in comparison with traditional models of cloud services that involve constant Golden Hand server provisioning as it dynamically provisions resources as needed.
Key Features and Benefits
Serverless Architecture: With Google Cloud Run, businesses no longer have to worry about managing servers. It removes all the intricate details, allowing the developers to concentrate on the application construction and application assertion.
Scalability on Demand: Cloud Run handles application scaling in real-time, up or down based on volume. When demand is low, it can reduce usage to zero so that you only pay for what you actually use.
Containerized Applications: Deploy your applications as containers, allowing any programming language, library, or binary to be utilized.
Integration with Google Cloud Services: Cloud Run easily integrates with many other Google Cloud services, such as Google Cloud Storage, Firestore, and BigQuery, to form a single and efficient cloud environment.
Typical Use Cases
Backend APIs for web and mobile apps
Event-driven microservices
Real-time data processing pipelines
Periodic batch jobs
How Does Google Cloud Run Work?
The most well-known innovation of Google Cloud Run is that it operates using cloud-based technology. How does it do this? Here's a quick breakdown of how it works:
Developers Deploy Containerized Applications: Your inclination with the frameworks and runtime environment is highly amplified as your application is bundled into a container. From that point forward, the container is loaded on the Google Cloud.
Handles Incoming Requests Automatically: No one likes waiting, especially customers; therefore, Google Cloud can bear multiple customers at one point to prevent any delay as per their request.
AutoScaling and Scaling to Zero: If there is no traffic, although rarely, the Google Cloud can self-scale down to zero during these non-peak times to avoid any compute cost.
Supports an Event-Driven Model: It can work with event triggers (through Eventarc) that fire once a file is added or a database is modified.
A Deep Dive into Google Cloud Run Pricing Structure
Google Cloud Run uses a pay-as-you-go pricing model, so the customers are charged only for the resources utilized by the applications instead of being charged a predetermined rate. The application’s operational costs include hiring AWS services, CPU, memory, networking, and idle instances. Pricing can be slightly different in terms of region as Google Cloud uses regional pools and classifies their pricing based on the usage rate in that region.
Key Components of Cloud Run Pricing
1. Compute Resources (CPU and Memory): While the container instance is active, you incur costs for the CPU and memory components it employs. It is charged on a per-second basis and then rounded to the nearest 100 milliseconds.
Example: when your container is utilized for 10 seconds with a vCPU of 1 and 512 MiB of memory:
Total cost: $0.0002525 or $0.0002500 (rounded).
Note: Rates may increase or decrease depending on the pricing tier of your selected region.
CPU Pricing: $0.00002400 per vCPU-second in Tier 1 regions.
Memory Pricing: $0.00000250 per GiB-second in Tier 1 regions.
CPU charges: 10 seconds × $0.00002400 = $0.00024
Memory charges: 10 seconds × 0.5 GiB × $0.00000250 = $0.0000125
2. Networking (Egress and Free Tier Limits): Outbound Internet traffic, or egress, has a cost based on the volume of data that is transferred.
Example: Applying the same logic mentioned above, if your application can transfer 5 GiB of data in a month and if the first 1 gigabyte is free, and you are in a region which charges $0.12 for every GiB of egress. In such a case, you would be paying for the remaining 4 GiB as follows:
4 GiB × $0.12 = $0.48.
Free Tier: 1 GiB of free outbound monthly data transfer (North America).
After those first one gigabyte, the rest of the Google Cloud network is billed according to its region.\
3. Request Volume: You pay for the number of requests served in a manner the container can use. The first 2 million requests every month are free for the user, and if one exceeds that, the charges mount up to $0.40 for every additional million requests in tier-one regions.
Example: If your application can track 4 million requests monthly:
First 2 million requests: Free.
Remaining 2 million requests: 2 × $0.40 = $0.80.
4. Idle Instance Costs (Optional): You will incur read costs on idle CPU and memory if you enable a minimum number of instances to maintain some container instances in a ‘warm’ state on a container level for quicker reply to incoming requests. This will apply even if the cases are idle in terms of request processing.
Example: If you keep 1 idle (low traffic) instance with 30 days (24 hours/day), for every 1 vCPU, I want it to have 512 MiB:
Total idle cost: $62.21 + $3.24 = $65.45.
CPU charges: 30 days × 24 hours/day × 3600 seconds/hour × $0.000024 = $62.21
Memory charges: 30 days × 24 hours/day × 3600 seconds/hour × 0.5 GiB × $0.00000250 = $3.24
Pricing Across Regions
Google Cloud divides its regions into different pricing tiers. Tiers usually include Tier 1 and Tier 2, for example. Tier 1 locations (some Regions in the US and located in Europe) are generally cheaper than Tier 2, which comprises some Regions in South America and Asia—on another note, working on a fixed budget? Check out Google Pricing Calculator to estimate the region-based costs.
Free Tier Allowances
One of the most important features of Google Cloud Run is that it features a generous free tier:
CPU Usage: First 180,000 vCPU-seconds per month are free.
Memory Usage: First 360,000 GiB-seconds per month are free.
Requests: First 2 million requests per month are free.
Additional Pricing Benefits
Google Cloud Run has been built to focus on cost savings for companies while ensuring a high level of service. Their approach to cost optimization is the following:
Automatic Scaling: Cloud Run will enable or disable instances of a container automatically, depending on the load this application needs. This means that when the application needs to work harder during peak usage times, more container instances will be added. But when idle, these instances will go down to zero, meaning you won't be charged if the application takes a break.
Pay-As-You-Go Pricing: MultiCloud charges its users by the second and links these costs to how much they actually took advantage of the service. There are no powerful fixed fees, and the costs should be measured before provisioning to ensure they will not spend more than necessary.
Committed Use Discounts (CUDs): If your business has a regular level of work and load, Cloud Run can provide worthwhile discounts which require you to maintain that level of load for a year or longer. This helps lessen the expenses required for steady operations.
Resource Configuration: It is possible to set each instance of the container to require less CPU and memory if it is not needed. Doing so minimizes exorbitant spending on unnecessary resources, hence increasing competitiveness.
Case Study: SmartHR’s Journey to Cost Optimization with Cloud Run
HR cloud solution services company SmartHR, Inc. is reported to have moved its ‘SmartHR’ system to the Google Cloud platform, which encompasses App Engine and Cloud Run, to put up a serverless and modernized setting. This allowed for resolving concerns such as the growing complexity of the infrastructure, internal control issues and performance problems. Migration details include:
Five-fold performance boost: With the introduction of cloud run, SmartHR’s new capabilities saw a jump from 100rps to around 500rps in a single session.
Reduced operational costs by 30%: A serverless configuration meant that teaching the users required less time, letting teams devote their time and energy towards the primary development requirements.
Streamlined internal controls: With Terraform and Google Workspace, the management and oversight for compliance and security became significantly easier.
Unified tech stack: By improving the infrastructure standard, cross-team integration and knowledge sharing across different units became easier.
Tools and Tips for Cutting Google Cloud Run Costs
The tools and tips below can help you get the most out of your Google Cloud while also helping you keep costs low.
Recommended Tools
Google Cloud Console: The console monitors your Cloud Run resources and tracks costs in real-time. It is even helpful for predicting future costs.
Billing Alerts: Set up spending alerts via Google Cloud Billing to avoid unexpected bills.
Pricing Calculator: Set up different scenarios using the Google Cloud Pricing Calculator, which would give us an estimate of the different costs we can incur.
Tips for Cost Optimization
Choose the Right Instance Types: The container for your builds must be configured only for the required resources, so make sure to choose the right instances for it.
Use Multi-Region Deployments: There is the option of setting up traffic routing to the closest region, so there is less cost and latency, which greatly helps.
Leverage Free Tier Limits: Whenever there is any uncertainty regarding the free tier limits, it is best to schedule workloads.
Monitor Cold Starts: If the code of the application is optimized, then measuring cold starts latencies can improve performance and resource usage.
Conclusion
The characteristics of Cloud Run and its features are perfect for running containerized applications as it is both cost-effective and has a great scale. When it is paired with a generous free tier and only paying for what you use, the transition to a serverless platform is seamless.
Whether you're running a small side project or scaling globally, understanding how Cloud Run pricing works can help you make smarter financial and infrastructural decisions.
Join Pump for Free
If you found this post interesting, consider checking out Pump, which can save you up to 60% off AWS for early-stage startups, and it’s completely free (yes, that's right!). Pump has tailor-made solutions to take you in control of your AWS and GCP spend in an effective way. So, are you ready to take charge of cloud expenses and maximize the most from your investment in AWS? Learn more here.