Cloud Functions pricing (GCP): invocations, duration, egress, and log volume

The best Cloud Functions estimate is "unit economics": per-invocation drivers multiplied by monthly volume. Keep compute, transfer, and logs as separate lines so you can see what actually dominates as traffic grows.

0) Identify what triggers invocations (choose the right driver)

  • HTTP: driver is requests/month.
  • Event-driven: driver is events/messages/month (Pub/Sub, storage events).
  • Scheduler: driver is runs/day (plus any fan-out).
  • Fan-out: one trigger may create N downstream invocations (hidden multiplier).

Tool: RPS to monthly requests (for rate-based drivers).

1) Invocations (per month)

Convert your driver into monthly invocations. Keep baseline and peak periods separate (batch jobs, incidents, marketing spikes).

  • Include retries: a retry rate of 50% increases invocations by 1.5×.
  • Include background traffic: health checks, bots, cron pings.

2) Duration (the compute multiplier)

Duration turns invocations into compute. Model at least two percentiles (p50 and p95) to capture slow-path behavior. Slow paths are usually caused by upstream latency (DB/APIs), cold starts, and throttling.

  • Track dependency time: external calls dominate duration for many functions.
  • Keep a peak scenario: incidents increase duration and retries at the same time.

3) Outbound transfer (egress can dominate)

Outbound transfer becomes material when functions return large payloads or call external APIs. Estimate response size separately from compute so you can see what is driving the bill.

Tools: Response transfer, Egress.

  • Split destinations: same-region vs cross-region vs internet have different billing behavior.
  • If one endpoint returns large payloads, model it separately (heavy tail).

4) Logs (ingestion + retention + scan)

Logging scales with volume. If each invocation logs a few KB and you have millions of invocations, log ingestion can exceed compute. Model ingestion and retention explicitly.

Tools: Log ingestion, Tiered log storage, Scan/search.

Worked estimate template (copy/paste)

  • Invocations/month = baseline + peak (include retries and fan-out)
  • Duration = p50 + p95 scenario (seconds)
  • Egress GB/month = invocations/month × avg response size (GB) + external API egress
  • Log GB/month = invocations/month × avg log bytes/invocation (sample real payloads)

Common pitfalls

  • Ignoring retries/timeouts (multipliers on invocations, duration, and transfer).
  • Using one average duration instead of modeling the slow path (p95 matters).
  • Returning large payloads without modeling egress separately.
  • Verbose logs per invocation (log ingestion dominates at scale).
  • Not separating baseline vs peak months (incidents create a different cost profile).

How to validate

  • Measure invocations and duration over a representative window (baseline + peak).
  • Validate retry rates and timeout behavior during incident windows.
  • Sample real log payload size and multiply by invocation volume.
  • Validate response sizes/top endpoints by bytes (avoid blended averages).

Related tools

Sources


Related guides

GCP Cloud Run Pricing & Cost (requests, CPU/memory, egress)
Model Cloud Run cost from requests, duration, CPU/memory time, and egress. Includes validation tips for real workloads.
Cloud CDN pricing (GCP): bandwidth, requests, and origin egress (cache fill)
A practical Cloud CDN cost model: edge bandwidth, request volume, and origin egress (cache fill). Includes validation steps for hit rate by path, heavy-tail endpoints, and purge/deploy events that reduce hit rate.
Google Kubernetes Engine (GKE) pricing: nodes, networking, storage, and observability
GKE cost is not just nodes: include node pools, autoscaling, requests/limits (bin packing), load balancing/egress, storage, and logs/metrics. Includes a worked estimate template, pitfalls, and validation steps to keep clusters right-sized.
Serverless costs explained: invocations, duration, requests, and downstream spend
A practical serverless cost model: invocations and duration (compute time), request-based add-ons, networking/egress, and the log/metric drivers that often dominate totals.
Artifact Registry pricing (GCP): storage + downloads + egress (practical estimate)
A practical Artifact Registry cost model: stored GB-month baseline, download volume from CI/CD and cluster churn, and outbound transfer. Includes a workflow to estimate GB-month from retention and validate layer sharing and peak pull storms.
Cloud Armor pricing (GCP): model baseline traffic, attack spikes, and logging
A practical Cloud Armor estimate: baseline request volume plus an attack scenario (peak RPS × duration). Includes validation steps for spikes, rule footprint, and the secondary cost driver most teams miss: logs and analytics during incidents.

Related calculators


FAQ

What usually drives Cloud Functions cost?
Invocations and duration are the core drivers, but outbound transfer and log ingestion can dominate for high-volume or chatty workloads.
How do I estimate quickly?
Estimate monthly invocations and duration, then add separate line items for response/outbound transfer and log bytes per invocation (plus retention).
Why do serverless bills spike during incidents?
Retries and timeouts multiply invocations and duration. Incident logging often becomes more verbose, creating a second spike from log ingestion.
How do I validate?
Validate trigger volume, retry rates, p95 duration, and average log payload size from real samples. Do not validate on a single good day.

Last updated: 2026-01-27