Cloud Functions pricing

Cloud Functions are priced according to how long your function runs, how many times it is invoked and how many resources you provision for the function. If your function makes an outbound network request, there are also additional data transfer fees. Cloud Functions includes a perpetual free tier for invocations to allow you to experiment with the platform at no charge. Note that even for free tier usage, we require a valid billing account.

Cloud Functions uses Cloud Build to convert your function source code into an executable image. The images for Cloud Functions are stored in either Container Registry or Artifact Registry. Cloud Functions (2nd gen) exclusively uses Artifact Registry. If your function uses Container Registry, you will incur charges for storing your function's image, even when your use of Cloud Functions falls within the free tier. Artifact Registry has its own free tier of storage. If you deploy your functions to Artifact Registry and exceed the Artifact Registry free tier usage, you will incur charges for deploying your functions, even when your use of Cloud Functions falls within the free tier. For more information about where a function's image is stored, see Building Cloud Functions Images. Pricing for Cloud Build, Container Registry, and Artifact Registry is not included in the Cloud Functions pricing below. To review pricing for these services, see the Cloud Build Pricing, Container Registry Pricing, and Artifact Registry Pricing pages.

Cloud Functions (2nd gen) uses Eventarc for event delivery. Pricing for Eventarc is not included in the Cloud Functions pricing below. Review pricing on the Eventarc Pricing page.

Cloud Functions (2nd gen) pricing is based on Cloud Run pricing. For information about Cloud Run pricing, see the Cloud Run Pricing page.

For information about Firebase Functions pricing, see the Firebase Pricing page.

All prices quoted are in US Dollars. If you pay in a currency other than USD, the prices listed in your currency on Cloud Platform SKUs apply.

Invocations

Function invocations are charged at a flat rate regardless of the source of the invocation. This includes HTTP function invocations from HTTP requests, events forwarded to background or CloudEvent functions, and invocations resulting from the call API. The pricing tiers shown below are based on the total number of function invocations across all functions associated with a particular Google Cloud Platform billing account.

Invocations per month Price/million
First 2 million Free
Beyond 2 million $0.40

If you pay in a currency other than USD, the prices listed in your currency on Cloud Platform SKUs apply.

Invocations are charged at a per-unit rate of $0.0000004 per invocation (or $0.40 per million), excluding the first 2 million free invocations per month. You incur charges regardless of the outcome of the function or its duration. You also incur charges for deploying your functions, even if the number of invocations falls within the free tier. For more information about how deployment charges are calculated, see Deployment costs.

Compute Time

Compute time is measured from the time your function receives a request to the time it completes, either through you signaling completion, or through a timeout, other failure or any other termination. Compute time is measured in 100ms increments, rounded up to the nearest increment. For example, a function executing for 260ms would be billed as 300ms.

Fees for compute time are variable based on the amount of memory and CPU provisioned for the function. Units used in this calculation are:

  • GB-Seconds

    • 1 GB-second is 1 second of wallclock time with 1GB of memory provisioned
  • GHz-Seconds

    • 1 GHz-second is 1 second of wallclock time with a 1GHz CPU provisioned

Disk size, memory, and network usage are calculated in gigabytes (GB), where 1GB is 2^30 bytes. This unit of measurement is also known as a gibibyte (GiB). 1GHz is considered as 10^9 Hertz:

Cloud Functions can be provisioned as one of the following types:

Memory vCPU1 Price/100ms (Tier 1 Price) Price/100ms (Tier 2 Price)
128MB .083 vCPU $0.000000231 $0.000000324
256MB .167 vCPU $0.000000463 $0.000000648
512MB .333 vCPU $0.000000925 $0.000001295
1024MB .583 vCPU $0.000001650 $0.000002310
2048MB 1 vCPU $0.000002900 $0.000004060
4096MB 2 vCPU $0.000005800 $0.000008120
8192MB 2 vCPU $0.000006800 $0.000009520
16384MB2 4 vCPU $0.000013600 $0.000019040
32768MB2 8 vCPU $0.000027200 $0.000038080

If you pay in a currency other than USD, the prices listed in your currency on Cloud Platform SKUs apply.

1 vCPU is equal to 2.4GHz. CPU allocations are an approximation and are subject to change. Actual allocation of CPU clock cycles may vary slightly across function invocations.
2 Only supported for 2nd gen Cloud Functions, and may not be supported in all regions either.

More generally, the cost of one second of compute time is as follows:

Unit Tier 1 Pricing Tier 2 Pricing
GB-Second $0.0000025
($0.0000025 if idle*)
$0.0000035
($0.0000035 if idle*)
GHz-Second $0.0000100
($0.000001042 if idle*)
$0.0000140
($0.00000146 if idle*)
Regions that have Tier 1 pricing Regions that have Tier 2 pricing

If you pay in a currency other than USD, the prices listed in your currency on Cloud Platform SKUs apply.

* idle refers to idle time of instances kept warm using minimum instances.

Idle time

If you set a minimum number of function instances, you are also billed for the time these instances are not active. This is called idle time and is priced at a different rate.

Concurrency

Cloud Functions (2nd gen) can take advantage of concurrency, through the underlying Cloud Run service, to give more control over pricing. You can learn more about concurrency in the Cloud Functions (2nd gen) Overview and on the Concurrency page in the Cloud Run documentation.

Free Tier

Cloud Functions provides a perpetual free tier for compute-time resources, which includes an allocation of both GB-seconds and GHz-seconds. In addition to the 2 million invocations, the free tier provides 400,000 GB-seconds, 200,000 GHz-seconds of compute time and 5GB of Internet data transfer out per month. The free tier is measured as a dollar equivalent to the Tier 1 pricing listed above. The equivalent dollar amount is provided whether you run your functions in a region with Tier 1 pricing or Tier 2 pricing or both. However, the deduction of usage of the free tier will be based on whether the region in which the function is running is in Tier 1 or Tier 2.

Note that even for free tier usage, we require a valid billing account.

Networking

Outbound data transfer (that is, data transferred from your function out to somewhere else) is measured in GB and charged at a flat rate. Outbound data to other Google APIs in the same region is free, as is inbound data. Google APIs that are global (i.e. not region-specific) are considered to be the same region.

Type Price/GB
Outbound Data $0.12
Outbound Data per month 5GB Free
Inbound Data Free
Outbound Data to Google APIs in the same region Free

If you pay in a currency other than USD, the prices listed in your currency on Cloud Platform SKUs apply.

Local Disk

Cloud Functions provides access to a local disk mount point (/tmp) which is known as a "tmpfs" volume in which data written to the volume is stored in memory. There is no specific fee associated with this however writing data to the /tmp mountpoint will consume memory resources provisioned for the function.

Pricing Examples

This section provides some pricing examples and some information about costs incurred as part of the deployment process. For more information on costs associated with Cloud Build, Artifact Registry, or Container Registry, see Building Cloud Functions Images. These examples do not include costs incurred by other Google Cloud products or APIs that you use within your function.

Simple Event-Driven Function

A simple event-driven function with 128MB of memory and a 200MHz CPU, invoked 10 million times per month and running for 300ms each time using only Google APIs (no billable outbound data transfer).

Calculations

Invocations

10,000,000

Compute Time

(128 MB / 1024 MB/GB) x 0.3s = 0.0375 GB-seconds per invocation

(200 MHz / 1000 MHz/GHz) x 0.3s = 0.0600 GHz-seconds per invocation

10,000,000 invocations x 0.0375 GB-seconds = 375,000 GB-seconds per month

10,000,000 invocations x 0.0600 GHz-seconds = 600,000 GHz-seconds per month

Networking

None

Metric Gross Value Free Tier Net Value Unit Price Total Price
Invocations 10,000,000 2,000,000 8,000,000 $0.0000004 $3.20
GB-seconds 375,000 400,000 < 0 $0.0000025 $0.00
GHz-seconds 600,000 200,000 400,000 $0.0000100 $4.00
Networking 0 5 0 $0.12 $0.00
Total / Month $7.20

If you pay in a currency other than USD, the prices listed in your currency on Cloud Platform SKUs apply.

High Volume HTTP Function

A medium complexity HTTP Function with 256MB of memory and a 400MHz CPU, invoked 50 million times per month via HTTP, running for 500ms each time and sending 5KB of data back to the caller (5KB outbound data transfer per invocation).

Calculations

Invocations

50,000,000

Compute Time

(256 MB / 1024 MB/GB) x 0.5s = 0.125 GB-seconds per invocation

(400 MHz / 1000 MHz/GHz) x 0.5s = 0.200 GHz-seconds per invocation

50,000,000 invocations x 0.125 GB-seconds = 6,250,000 GB-seconds per month

50,000,000 invocations x 0.200 GHz-seconds = 10,000,000 GHz-seconds per month

Networking

50,000,000 invocations x (5 KB / 1024 KB/MB / 1024 MB/GB) = 238.42 GB of outbound data transfer per month

Metric Gross Value Free Tier Net Value Unit Price Total Price
Invocations 50,000,000 2,000,000 48,000,000 $0.0000004 $19.20
GB-seconds 6,250,000 400,000 5,850,000 $0.0000025 $14.63
GHz-seconds 10,000,000 200,000 9,800,000 $0.0000100 $98.00
Networking 238.42 5 233.42 $0.12 $28.01
Total / Month $159.84

If you pay in a currency other than USD, the prices listed in your currency on Cloud Platform SKUs apply.

Deployment costs

Functions are stored in either Container Registry or Artifact Registry. Cloud Functions (2nd gen) exclusively uses Artifact Registry.

If your functions are stored in Container Registry, you'll see small charges after you deploy because Container Registry has no free tier. Container Registry's regional storage costs are currently about $0.026 per GB per month.

Take for example a project deploying fifteen 1st gen Node.js 10 functions that pull in a number of common npm packages. Deploying these functions would result in the use of some free storage, some billed multiregion storage, and a small amount of Cloud Build compute time:

  • 1.05 GB of Standard multiregion storage (which has no free tier) in its REGION.artifacts.* bucket. This multiregion storage space is used by Container Registry.
  • 2 MB of free-tier Cloud Storage in its gcf-sources-* bucket. This free storage is used in the function build process.
  • Roughly 1 minute of Cloud Build build-minutes per function deploy, which falls within Cloud Build's free tier as long as you don't deploy all fifteen functions more than 8 times per day.

That amounts to $0.03 / month. A charge such as this would show up in your bill as "Standard Storage US Multi-region".

If your functions are stored in Artifact Registry, you won't be charged unless you exceed its free tier of storage. If your function exceeds that limit, you'll see small charges for storage after you deploy.

Since each function's container is stored in an image registry (Container Registry or Artifact Registry) until you delete that function, you would see a small charge every month (unless you use Artifact Registry and fall into its free tier limit).

For more information on costs associated with Cloud Build or Artifact Registry, see Building Cloud Functions Images.

What's next

Request a custom quote

With Google Cloud's pay-as-you-go pricing, you only pay for the services you use. Connect with our sales team to get a custom quote for your organization.
Contact sales