Pricing

Cloud Functions are priced according to how long your function runs, how many times it's 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 to allow you to experiment with the platform at no charge. Note that even for free tier usage, we require a valid billing account.

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.

Cloud Functions Pricing

This section provides details about Cloud Functions pricing.

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, excluding the first 2 million free invocations per month and are charged regardless of the outcome of the function or its duration.

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 6 types:

Memory CPU1 Price/100ms (Tier 1 Price)
128MB 200MHz $0.000000231
256MB 400MHz $0.000000463
512MB 800MHz $0.000000925
1024MB 1.4 GHz $0.000001650
2048MB 2.4 GHz $0.000002900
4096MB 4.8 GHz $0.000005800

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

1 CPU allocations are an approximation. Actual allocation of CPU clock cycles may vary slightly across function invocations.

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.0000035
GHz-Second $0.0000100 $0.0000140

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

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 egress traffic per month. The free tier is measured as a dollar equivalent to the Tier 1 pricing listed in the table above. The equivalent dollar amount is allocated to you whether you run your functions in a region with Tier 1 pricing, Tier 2 pricing, or both. However, the deduction of usage of the free tier is based on whether the region in which the function is running is in Tier 1 or Tier 2. In other words, if a function is running in a region with Tier 1 pricing, the deduction is based on Tier 1 pricing. Likewise, if a function is running in a region with Tier 2 pricing, the deduction is based on Tier 2 pricing.

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 (Egress) $0.12
Outbound Data per month 5GB Free
Inbound Data (Ingress) 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 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 Background Function

A simple background 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 egress).

Calculations

Invocations

10,000,000

Compute Time

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

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

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

10,000,000 x 0.0600 = 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 egress per invocation).

Calculations

Invocations

50,000,000

Compute Time

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

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

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

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

Networking

50,000,000 x (5 / 1024 / 1024) = 238.42 GB of egress traffic 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

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

Take for example a project deploying fifteen 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 a little less than $0.03 / month. A charge such as this would show up in your bill as "Standard Storage US Multi-region." Since each function's container is stored in Container Registry until you delete that function, you would see a small charge every month.

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