Compute
Cloud Functions
Event-driven serverless functions
AWS equivalent
Lambda
AWS → GCP: Key Differences
- ▸
Very similar to Lambda — event-driven, pay-per-invocation, scales automatically.
- ▸
Cloud Functions 2nd gen (built on Cloud Run) is much more powerful than 1st gen.
- ▸
Triggers: HTTP, Pub/Sub, Cloud Storage events, Firestore, Firebase — similar breadth to Lambda.
Key Concepts to Know
- 1
Supported runtimes: Node.js, Python, Go, Java, Ruby, PHP, .NET.
- 2
Trigger types: HTTP (direct invocation), event-based (Pub/Sub, GCS, Firestore).
- 3
Timeout: up to 9 minutes (1st gen) or 60 minutes (2nd gen).
- 4
Environment variables for config. Secret Manager integration for secrets.
- 5
VPC connector to reach private resources.
DCE Interview Tips
- ★
Use Cloud Functions for: simple event handlers (process a file in GCS, react to a Pub/Sub message, webhook endpoint).
- ★
Cloud Functions vs Cloud Run: 'Functions for simple single-purpose event handlers. Cloud Run for anything needing a full server runtime or multiple endpoints.'
Common Gotchas
- !
Cold start can be an issue for latency-sensitive paths — same mitigation as Cloud Run (min instances).
- !
1st gen Functions have 1 concurrent request per instance limit. 2nd gen allows concurrency.