Cloud Functions 2nd gen is GCP's evolved serverless function service, internally built on Cloud Run + Eventarc. With 60-minute execution, Cloud Run-grade infrastructure, and 90+ event sources, it's now ready for enterprise-class serverless workloads.
| Item | 1st gen | 2nd gen |
|---|---|---|
| Foundation | Proprietary runtime | Cloud Run + Eventarc |
| Max execution time | 9 min | 60 min |
| Concurrency | 1 request / instance | 1-1000 (configurable) |
| Max memory | 8 GB | 16 GB |
| Max vCPU | 2 | 4 |
| Event sources | Limited | 90+ (via Eventarc) |
| HTTP/2 support | No | Yes |
| VPC connectivity | VPC connector required | Direct VPC Egress supported |
| Recommended for new | — | Yes |
| Item | Price (us-central1) |
|---|---|
| vCPU-time | $0.00002400 / vCPU-second |
| Memory-time | $0.00000250 / GiB-second |
| Requests | $0.40 / million |
| Free tier | 2M requests, 400,000 GB-seconds, 200,000 vCPU-seconds per month |
import functions_framework
@functions_framework.http
def hello_http(request):
name = request.args.get('name', 'World')
return f'Hello {name}!'
@functions_framework.cloud_event
def hello_pubsub(cloud_event):
import base64
data = base64.b64decode(cloud_event.data['message']['data']).decode()
print(f'Received: {data}')# Deploy gcloud functions deploy hello-http \ --gen2 --runtime=python311 --region=asia-northeast1 \ --source=. --entry-point=hello_http \ --trigger-http --allow-unauthenticated
| Item | 2nd gen | AWS Lambda | Azure Functions |
|---|---|---|---|
| Max execution time | 60 min (HTTP) / 60 min (Event) | 15 min | 10 min (60 min on Premium) |
| Max memory | 16 GB | 10 GB | 14 GB (Premium) |
| Concurrency | Concurrency 1-1000 | 1 request / worker | 1〜200 |
| Languages | Node/Python/Go/Java/.NET/Ruby/PHP | Many | Many |
| Free tier / month | 2M requests | 1M requests | 1M requests |
What's the difference between Cloud Functions 1st gen and 2nd gen?
2nd gen runs on Cloud Run + Eventarc under the hood. It supports 60-minute execution, concurrency up to 1000, up to 16 GB memory, and 90+ event sources via Eventarc. 2nd gen is recommended for all new workloads.
Should I use Cloud Run or Cloud Functions 2nd gen?
Use 2nd gen for simple function-per-endpoint workloads; use Cloud Run for full web APIs, complex routing, or full container control. Both run on the same underlying infrastructure.
Which languages are supported?
Node.js, Python, Go, Java, .NET, Ruby, and PHP. You can also run custom containers via Buildpacks.
How bad are cold starts?
With Min Instances 0, expect 100ms to a few seconds. Setting Min Instances 1+ keeps instances warm (at a cost). Java and Python tend to be slower; Go and Node.js start faster.
How is pricing structured?
You pay for requests + CPU-seconds + memory-seconds. The free tier covers 2M requests, 400,000 GB-seconds, and 200,000 vCPU-seconds per month. Same billing model as Cloud Run.
What is Eventarc?
GCP's standard eventing backbone. It delivers events from 90+ sources (Cloud Storage, Audit Logs, Pub/Sub, etc.) to Cloud Functions, Cloud Run, and Workflows.
How does it compare to AWS Lambda?
Lambda caps at ~15 minutes; 2nd gen goes to 60 minutes. Lambda scales higher on concurrency (1000 default, up to 100K). Eventarc is roughly equivalent to EventBridge.
How should I configure the Service Account?
Create a dedicated SA per function with least-privilege predefined roles. Avoid using the default App Engine SA in production.
Related articles: Serverless
Professional Cloud Developer (PCD): Complete Guide (2026)
Pass the PCD exam — Cloud Run, GKE, App Engine, Cloud SQL/Spanner. The developer-focused Professional cert.
App Engine Complete Guide: Standard vs Flexible (2026)
App Engine — Standard vs. Flexible, services, versions, traffic splitting. The classic GCP PaaS.
Cloud Deploy Complete Guide: GitOps for GKE (2026)
Cloud Deploy — delivery pipelines, targets, rollouts. The progressive delivery service for GKE.
Workflows & Cloud Tasks Guide (2026)
Workflows for orchestration, Cloud Tasks for async work — when each fits, common patterns.
Google Cloud is a trademark of Google LLC. For the latest information, see the official Cloud Functions documentation.
Practice with certification-focused question sets
See GCP exam prepNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Google Cloud Certification Roadmap (2026)
Choose your GCP certification path — Foundational, Associate...
CDL Cloud Digital Leader: Complete Exam Guide (2026)
Pass the Cloud Digital Leader exam — cloud business value, G...
GAIL Generative AI Leader: Complete Exam Guide (2026)
Pass the Generative AI Leader exam — Gemini, Vertex AI, Work...
Vertex AI Fundamentals for GCP Certs (2026)
Vertex AI basics every cert candidate needs — Workbench, Pip...
Associate Cloud Engineer (ACE): Complete Guide (2026)
Pass the Associate Cloud Engineer exam — Console, gcloud, pr...