A public, serverless Prebid Cache instance on Google Cloud Run
Scales to zero • Pay per request • ~$0-15/moPrebid Cache stores short-term data (typically video ad markup or JSON bid responses) and returns a UUID that can be used to retrieve it.
curl -X POST https://prebid.video/cache \
-H "Content-Type: application/json" \
-d '{
"puts": [
{
"type": "json",
"value": {"adm":"<VAST>...</VAST>","nurl":"https://example.com"}
}
]
}'
Response:
{
"responses": [
{"uuid": "d4e5f678-1234-5678-9abc-def012345678"}
]
}
curl https://prebid.video/cache?uuid=d4e5f678-1234-5678-9abc-def012345678
curl -X POST https://prebid.video/cache \
-H "Content-Type: application/json" \
-d '{
"puts": [
{
"type": "xml",
"value": "<VAST version=\"3.0\">...</VAST>",
"ttlseconds": 3600
}
]
}'
Optional fields per entry: ttlseconds (max 10800), key (if allowed by config), type ("json" or "xml").
Running your own Prebid Cache on Cloud Run takes about 15 minutes and costs $0-15/month. Here's how:
gcloud CLI installed and authenticated# Set your project
gcloud config set project YOUR_PROJECT_ID
# Enable required APIs
gcloud services enable run.googleapis.com artifactregistry.googleapis.com cloudbuild.googleapis.com
# Create an Artifact Registry repository
gcloud artifacts repositories create prebid-cache \
--repository-format=docker \
--location=us-central1
# Clone the repo
git clone https://github.com/headertag/prebid-cache.git
cd prebid-cache
# Build remotely with Cloud Build and deploy to Cloud Run
export GCP_PROJECT_ID=your-project-id
export REDIS_HOST=your-upstash-endpoint
export REDIS_PORT=6379
export REDIS_PASSWORD=your-upstash-password
./deploy/deploy.sh
# Map your domain
gcloud run domain-mappings create \
--service prebid-cache \
--domain your-domain.com \
--region us-central1
# Then add the DNS records shown by the command above
Cloud Run provides free, auto-renewing Google-managed SSL certificates. No Let's Encrypt setup is needed.
# Store a test value
curl -X POST https://YOUR_CLOUD_RUN_URL/cache \
-H "Content-Type: application/json" \
-d '{"puts":[{"type":"json","value":{"test":true}}]}'
# Retrieve it using the returned UUID
curl https://YOUR_CLOUD_RUN_URL/cache?uuid=RETURNED_UUID
| Component | Monthly Cost | Notes |
|---|---|---|
| Cloud Run | $0–5 | min-instances=0, scales to zero, generous free tier |
| Upstash Redis | $0–10 | Serverless pay-per-request, free tier included |
| SSL Certificate | $0 | Google-managed, auto-renewing |
| Artifact Registry | $0 | 0.5GB free tier covers the Docker image |
| Total | $0–15 | Only costs more under heavy traffic |
Why Upstash Redis over Google Memorystore? Memorystore starts at ~$160/month minimum even when idle. Upstash is truly serverless — $0 when no requests are made. It speaks standard Redis protocol, so it works with the existing go-redis/redis/v8 client in prebid-cache with TLS support.
Prebid Cache reads configuration from config.yaml and environment variables prefixed with PBC_. Environment variables take precedence and use underscores instead of dots (e.g., PBC_BACKEND_TYPE=redis).
| Env Variable | Description | Example |
|---|---|---|
PBC_BACKEND_TYPE | Storage backend | redis |
PBC_BACKEND_REDIS_HOST | Redis host | us1-xxx.upstash.io |
PBC_BACKEND_REDIS_PORT | Redis port | 6379 |
PBC_BACKEND_REDIS_PASSWORD | Redis password | your-password |
PBC_BACKEND_REDIS_TLS_ENABLED | Enable TLS | true |
PBC_REQUEST_LIMITS_MAX_TTL_SECONDS | Max TTL for cached values | 10800 |