TExcelTAD
Home › Azure & Google Cloud for AWS Users › Functions, Container Apps and Cloud Run

Functions, Container Apps and Cloud Run

"Serverless" covers two shapes on every cloud: functions (you upload code for one handler, the platform runs it on events) and serverless containers (you give it an image, it runs and scales HTTP services or jobs, down to zero). Google Cloud has merged the two: its functions now run on Cloud Run.

On AWS this is… AWS Lambda for functions, and Fargate or App Runner for serverless containers, from Containers: ECS, EKS, Fargate, ECR.

Side by side

AWS Azure Google Cloud
Functions Lambda Azure Functions (Flex Consumption, Premium, Dedicated plans) Cloud Run functions (formerly Cloud Functions)
Serverless containers (HTTP) App Runner, ECS on Fargate Azure Container Apps Cloud Run services
Run-to-completion jobs ECS tasks, AWS Batch Container Apps jobs Cloud Run jobs
Scale to zero Lambda yes; Fargate no Functions (Flex Consumption) yes; Container Apps yes yes
Concurrency per instance 1 request per Lambda environment per-instance, configurable for Functions and Container Apps many requests per instance (default 80, configurable)
Triggers event source mappings, EventBridge bindings and triggers (Blob, Service Bus, Event Grid, HTTP, timers) HTTP, Eventarc (Cloud Storage, Pub/Sub, audit log events), Pub/Sub push
Underlying platform Firecracker microVMs Container Apps runs on Kubernetes (with KEDA, Dapr, Envoy) under the hood Cloud Run (Knative-compatible API)
Identity execution role managed identity service account per service

The concurrency row matters for cost and design. A Lambda environment handles one request at a time, so 100 concurrent requests need 100 environments. A Cloud Run instance handles up to 80 by default, so the same load might need two instances, and your code must be safe for concurrent requests (no global mutable state per request).

Model: instances needed for a load

python · try it yourself
import math

def instances(rps, latency_ms, concurrency):
    in_flight = rps * latency_ms / 1000          # Little's law: L = lambda * W
    return math.ceil(in_flight / concurrency), in_flight

print(f"{'rps':>5} {'latency':>8} {'in flight':>10} {'Lambda (1)':>11} {'Cloud Run (80)':>15} {'Cloud Run (10)':>15}")
for rps, latency in [(20, 100), (200, 100), (200, 800), (2000, 250)]:
    lam, inflight = instances(rps, latency, 1)
    run80, _ = instances(rps, latency, 80)
    run10, _ = instances(rps, latency, 10)
    print(f"{rps:>5} {latency:>6}ms {inflight:>10.0f} {lam:>11} {run80:>15} {run10:>15}")
  rps  latency  in flight  Lambda (1)  Cloud Run (80)  Cloud Run (10)
   20    100ms          2           2               1               1
  200    100ms         20          20               1               2
  200    800ms        160         160               2              16
 2000    250ms        500         500               7              50

Lower concurrency (the last column) is the right setting for CPU-heavy handlers: each request gets more of the instance. Tune concurrency to what one instance's CPU and memory can actually serve.

Deploying

Google Cloud, sample session: a container to Cloud Run, private, with its own service account.

bash
gcloud run deploy shop-api \
    --image=europe-west1-docker.pkg.dev/shop-prod-4821/shop/api:1.4.2 \
    --region=europe-west1 --service-account=shop-api@shop-prod-4821.iam.gserviceaccount.com \
    --no-allow-unauthenticated --port=8080 --concurrency=40 \
    --min-instances=0 --max-instances=20 --cpu=1 --memory=512Mi
gcloud run services describe shop-api --region=europe-west1 --format="value(status.url)"
text
https://shop-api-123456789012.europe-west1.run.app

--no-allow-unauthenticated means callers need the roles/run.invoker role and an identity token; put a load balancer with IAP or your API gateway in front for public traffic, or use --allow-unauthenticated for a genuinely public endpoint.

A function on Cloud Run functions, sample:

bash
gcloud functions deploy resize-image --gen2 --region=europe-west1 \
    --runtime=python313 --source=. --entry-point=handle \
    --trigger-bucket=shop-prod-uploads \
    --service-account=resizer@shop-prod-4821.iam.gserviceaccount.com

Azure, sample session: a Container Apps environment and an app that pulls from ACR with its managed identity.

bash
az containerapp env create -g rg-shop-prod-app -n cae-shop-prod -l westeurope \
    --infrastructure-subnet-resource-id "$SNET_CAE_ID"
az containerapp create -g rg-shop-prod-app -n shop-api --environment cae-shop-prod \
    --image acrshopprod.azurecr.io/shop/api:1.4.2 \
    --registry-server acrshopprod.azurecr.io --registry-identity system \
    --target-port 8080 --ingress external --min-replicas 0 --max-replicas 20 \
    --cpu 0.5 --memory 1.0Gi

Azure Functions, sample, using the Core Tools to publish code to an existing Flex Consumption app:

bash
az functionapp create -g rg-shop-prod-app -n func-shop-resize --storage-account stshopfunc01 \
    --flexconsumption-location westeurope --runtime python --runtime-version 3.12
func azure functionapp publish func-shop-resize

Choosing

  • Already have a container? Cloud Run or Container Apps: the closest match to "Fargate without the cluster".
  • Glue code reacting to cloud events? Azure Functions or Cloud Run functions: the closest match to Lambda.
  • Need Kubernetes features (custom controllers, DaemonSets)? Move up to AKS/GKE (Managed Kubernetes); GKE Autopilot is a middle ground.

Test yourself

A service gets 200 requests/s with 100 ms latency. How many instances does Cloud Run need at concurrency 80, compared with Lambda's one request per environment?

  1. 20 vs 20
  2. 1 vs 20
  3. 80 vs 200
  4. 3 vs 20

What is Google Cloud's current name for Cloud Functions?

  1. Cloud Run functions
  2. App Engine
  3. Cloud Tasks
  4. Eventarc

Which Azure service is the closest match to 'run my container image as an autoscaling HTTP service, down to zero'?

  1. Azure Batch
  2. Azure Container Apps
  3. Virtual Machine Scale Sets
  4. Azure Container Registry