PostgreSQL RLS vs Application Tenant Filters

Short answer: PostgreSQL row-level security is a database-enforced backstop, while an application tenant filter is a code convention that every caller must apply correctly. As of 2026-08-15, Google Cloud documents Cloud SQL editions, AWS documents PostgreSQL pricing, and 45 CFR 164.308 requires administrative safeguards and risk management. Neither control is complete without membership checks, privileged-role review, restore testing, and evidence.

Isolation model and threat boundary

The primary difference is where a missed filter is caught. An application filter adds a predicate in shared code and depends on every caller, query, job, report, and export preserving it. PostgreSQL RLS evaluates database policies for applicable roles and operations, creating a backstop when the application query is incomplete. That does not make the database universally safe, because privileged roles and alternate stores can bypass it.

Define the tenant boundary before choosing a control. A request has an authenticated principal, server-resolved membership, immutable home region, operation, and data scope. The application checks those values. The database policy then checks a transaction-scoped tenant context or equivalent server-side context. If context is missing, the desired result is denial or an empty scope, not a broad query.

45 CFR 164.308 describes administrative safeguards and risk management, not a required database product. The technical choice should be documented in the environment-specific risk analysis. Cloud SQL Editions and RDS PostgreSQL Pricing can inform platform and cost decisions, but a provider page does not establish isolation or legal sufficiency.

Control Strength Failure to test
Application filter Simple and portable One omitted predicate can widen a result
RLS backstop Database policy covers tested roles Privileged role or missing context can bypass
Membership Maps caller to tenant and role Client input or stale session can be trusted
Operations Controls exports, backups, and support Non-web paths may avoid both filters

Read Cloud SQL PostgreSQL RLS, compare RDS PostgreSQL and DynamoDB, and review Firestore Rules versus Admin SDK.

Enforcement path and bypasses

Application filters and RLS share the same identity prerequisite. Authenticate the caller, resolve membership and home region server-side, authorize the operation, and then set database context. Never let a browser choose a tenant predicate or a database context. A wrong-tenant request should fail before a useful row is returned.

For application filtering, grep and review every caller: web routes, scheduled jobs, queue consumers, reports, exports, admin views, support tools, migrations, and tests. A shared helper reduces duplication but does not prevent a direct query or new caller from bypassing it. Negative tests must assert that a wrong tenant cannot be read or changed.

For RLS, test session context, connection pooling, transaction boundaries, table policies, indexes, views, functions, owners, migrations, reporting roles, and direct database connections. A privileged role may bypass policy by design. Treat that role as a separate access path with approval, logging, and limited use.

Keep data minimum necessary in either model. A generic conversion record may use approved event type, time, currency, value, and an opaque reference. Do not send patient names, email addresses, phone numbers, hashed identifiers, service names, treatment details, or clinical text to advertising systems. Tenant isolation does not authorize an external disclosure.

caller
  -> membership and home region
  -> application authorization
  -> transaction tenant context
  -> RLS policy and query filter
  -> audit event without full row

Audit, restore, support, and offboarding

Off-path operations decide whether isolation is real. Run two synthetic tenants through web, queue, report, export, support, backup, restore, migration, and administrative paths. For each operation record identity, tenant context, expected result, observed result, and layer that enforced the decision.

Backups contain data outside the live query path. Restore into an isolated target, install roles and policies, verify tenant denial, inspect keys and logs, and delete the test copy. An application filter may not run during restore, and RLS may be absent until schema migration completes. The restore gate must explicitly test both.

Support access should be separate from application access. Use a time-limited approval, narrow tenant scope, reason code, and audit event. Test an operator who has no membership, an operator with one tenant, and an emergency operator. Do not create a permanent broad role to avoid an incident delay.

Offboarding needs return or destruction evidence. Identify live rows, queues, exports, backups, logs, and test copies. A database policy does not delete them. A code filter does not delete them. Retention, legal hold, and customer contract determine what remains and for how long.

Runnable proof tests

A small negative-test matrix is more valuable than a long positive demo. Use synthetic records for tenant A and tenant B.

  1. Read and update own-tenant records through the web path.
  2. Change tenant input and confirm denial before data access.
  3. Remove membership and confirm denial.
  4. Run reports, queue jobs, exports, direct database queries, and admin tools.
  5. For RLS, remove context, reuse a pooled connection, and use a privileged role.
  6. Back up and restore, then repeat tenant tests.
  7. Inspect logs, keys, support access, offboarding, and deletion evidence.

Keep a failing test for every known bypass. If one route remains code-only, say so in the risk record. If RLS covers only ordinary roles, state the privileged exception. The result is a bounded control claim instead of an unsupported promise.

Make the context contract explicit. Name the authenticated principal, membership lookup, tenant identifier, home region, transaction scope, database role, policy, and expected denial. Reject a request when any value is missing or inconsistent. Do not infer tenant from a record path, referrer, hostname, or browser state. Those values can help route a request, but they do not authorize a row.

Connection pooling is a high-value test because it joins separate requests to one database process. Run two concurrent synthetic tenants, change context, force an error, retry, and inspect both results. Repeat with a report and queue worker. If a context survives longer than intended, reset it or use a transaction-scoped design. If a missing context returns broad data, stop the deployment.

Review database owners, functions, views, migrations, foreign keys, indexes, exports, and administrative clients. RLS can be bypassed by a privileged role; code filters can be bypassed by a new caller. Record those exceptions and give each an owner, approval path, and negative test. Do not describe a control as universal when a known path is outside it.

Offboarding should be tested against live rows, outbox events, queues, reports, exports, backups, logs, and recovery copies. A tenant filter or row policy controls access, not deletion. Contract, legal hold, risk, and retention determine what remains. The Cloud SQL RLS guide gives a provider-specific context pattern, while logging retention covers evidence without copying full rows.

Choose the stronger control only after a measured proof. A database policy can reduce the blast radius of a missed filter, but it adds context, role, migration, and operational work. A code-only filter can be acceptable for a bounded non-sensitive path, but a critical shared store should document why no database backstop exists and how every caller is kept in scope.

Frequently asked questions

Is RLS always better than application filters?

RLS provides a useful database backstop, but it still needs safe context, role review, and testing. Application filters remain necessary for membership and may be the only control on non-database paths.

Can RLS protect backups and exports?

Not automatically. Backup, restore, export, support, queue, and admin workflows need their own identity, scope, retention, and negative tests.

What is the worst code-only failure?

A caller omits the tenant predicate or uses an untrusted tenant value and receives another tenant’s result. Search every caller and keep a negative test that would fail when the filter disappears.

What must be approved before production?

Engineering must prove identity, policy, bypass, restore, support, and offboarding paths. The customer and counsel must approve contracts, data use, retention, transfers, and legal questions.

References

Cloud Scheduler for Authenticated Healthcare Jobs

Short answer: Cloud Scheduler should call a protected job through an authenticated service identity, least-privilege target, bounded retries, and auditable failure handling. As of 2026-08-15, Google Cloud documents Scheduler pricing, Cloud Run pricing, and covered-product scope. An HTTP request that returns success is not enough if the job can be called without authentication or processes an unscoped tenant.

GCP service fit and regional boundary

Scheduler is a trigger, not an authorization system for application data. Google Cloud’s Scheduler Pricing page provides job cost inputs, Cloud Run Pricing provides target runtime inputs, and the HIPAA page describes covered-product scope and shared responsibility. Use these sources to bound the platform choice, then configure identity, region, data, logs, and retries.

Assign each job an owner, target service, region, service identity, schedule, timeout, retry policy, and payload schema. A job that runs in one region but calls a global endpoint or writes to another region needs explicit review. Keep tenant home region server-derived. Do not let a schedule payload choose a tenant or destination without authorization.

Prefer a generic job signal over a full record. The target service can look up approved server-side state under its own membership and data policy. For an approved conversion path, the outbound event may contain generic event type, time, currency, and value only. Do not send patient names, email addresses, phone numbers, hashed identifiers, service names, treatment details, or clinical text to advertising systems.

Job control Question Proof
Identity Which service identity can invoke the target? Allowed and denied calls
Scope How is tenant and region resolved? Server membership test
Reliability What happens on timeout or duplicate? Retry and idempotency test
Evidence What is logged and retained? Redacted audit review

Pair this with Cloud Run migration, logging retention, and outbox delivery design.

Request, data, key, and identity path

Authenticate the caller and authorize the work inside the target service. A Scheduler identity proves that an approved job called the endpoint; it does not prove that every tenant operation is allowed. The target should verify audience, service identity, job type, tenant membership, home region, and idempotency before reading or writing.

Use separate identities for Scheduler, target service, data access, deployment, key administration, support, and emergency work. The Scheduler identity should not read the database. The target identity should not administer the schedule. Least privilege makes failure evidence easier to interpret.

Keep secrets out of job payloads, URLs, headers, logs, and error messages. Use approved runtime secret access and test rotation. A generic payload should remain generic at every retry. Do not add personal identifiers or treatment detail to make a job easier to reconcile.

Cloud Scheduler identity
  -> authenticated target request
  -> audience and job verification
  -> tenant membership and region check
  -> bounded operation
  -> redacted audit event

Jobs, audit, backup, and failure handling

Retries must be safe and observable. Set timeout, retry count, backoff, and dead-letter or review behavior from the operation. Use an idempotency key for a job run. A duplicate trigger should not duplicate a booking state change or outbound generic conversion.

Test no authentication, wrong audience, wrong service identity, changed tenant, wrong region, expired secret, timeout, target error, retry, duplicate, and partial write. The target should deny unauthorized work before data access and should log a reason code without copying the payload.

Audit schedule changes, identity changes, manual runs, successful jobs, denied jobs, retries, dead letters, exports, restores, and support actions. Keep audit records minimum necessary. Review who can trigger a job manually. A scheduler administrator can create an unexpected data path even if the normal schedule is safe.

Backups and restore should include job state and outbox state where required. Restore synthetic records, replay a job, and confirm idempotency and tenant scope. Do not restore a job queue into production without reviewing stale payloads and approval state.

Cost and proof gate

Scheduler jobs are usually priced by job and target activity, but the control burden is not free. Use Cloud Scheduler and Cloud Run pricing for current inputs. Add logs, queues, keys, secrets, target calls, retries, monitoring, and review. Label estimates with schedule frequency, region, payload size, retention, and date.

  • Define identity, audience, target, region, and schema.
  • Verify tenant membership inside the target service.
  • Use idempotency and bounded retries.
  • Redact logs and inspect dead letters.
  • Recheck pricing and service behavior before launch.

Authenticated job proof

Use a synthetic tenant and an intentionally failing target.

  1. Run an approved job and verify identity and audience.
  2. Attempt an unauthenticated and wrong-identity call and confirm denial.
  3. Change tenant and region input and confirm server-side rejection.
  4. Force timeout and duplicate execution and verify idempotency.
  5. Inspect logs, dead letters, keys, secrets, and operator access.
  6. Restore job state and replay under approval.
  7. Record costs and unresolved contract questions.

The decision should identify what Scheduler authenticates, what the target authorizes, and what data remains outside the job path. Keep those claims separate.

Keep a job catalog with name, owner, target, identity, audience, region, schedule, timeout, retry, payload, data class, log class, backup, and approval. Review it whenever a job is added or its target changes. A manual trigger should use the same identity and authorization checks as the schedule, or it should be treated as a separate privileged path.

Use a generic control payload whenever possible. The target can query approved server-side state instead of receiving a full record. A job that creates an external conversion should validate tenant approval at execution time, not only when the schedule was created. If approval is missing or expired, quarantine the run and record a reason without sending.

Measure reliability and cost together. Run the job at normal cadence, force timeout, retry, duplicate execution, and dependency failure, then inspect Cloud Run calls, logs, queues, keys, and support notifications. Add Scheduler, runtime, logs, keys, secrets, queues, and review to the estimate. Recheck current provider pricing before launch.

The production gate is a reproducible denial. An unauthenticated call, wrong audience, wrong identity, wrong tenant, wrong region, or expired approval must not reach a protected data operation. The outbox review provides a companion pattern for retry and delivery gating.

Frequently asked questions

Does Cloud Scheduler authentication authorize tenant data access?

No. It authenticates the job caller. The target service must resolve tenant membership, region, operation, and minimum necessary data before access.

What should a scheduled payload contain?

Prefer a job type, run identifier, and bounded control metadata. Resolve protected records server-side. Do not place patient, contact, service, treatment, or clinical details in the payload.

How should retries be handled?

Use bounded retries, backoff, dead-letter or review state, and an idempotency key. Test duplicate and partial execution before production.

What should be approved?

Engineering approves identity, target, region, data, retry, logging, and recovery evidence. The customer and counsel approve contracts, use, transfer, and legal questions.

References

Google Cloud Logging Retention for HIPAA Audit Evidence

Short answer: Google Cloud Logging retention should preserve audit evidence while preventing protected health information from entering logs in the first place. As of 2026-08-15, Google Cloud publishes Logging pricing and covered-product scope, while NIST SP 800-53 Revision 5 Update 1 provides control and evidence concepts. Retention length must follow risk, contract, and operational need, not an assumption that every log belongs for six years.

GCP service fit and regional boundary

Cloud Logging can retain evidence, but it cannot make unsafe application logging safe. Google Cloud Logging Pricing provides ingestion and retention inputs. The HIPAA page describes covered-product scope and shared responsibility. NIST SP 800-53 Revision 5 Update 1 offers a control reference for audit, access, configuration, and monitoring evidence. Use these sources to design the log system and keep claims narrow.

Choose log classes first: security audit, application operational, debug, access, deployment, database, queue, and incident evidence. For each class, define fields, location, retention, access roles, export destination, alerting, deletion, and owner. A global sink can change the data path even when the application and database are regional.

Do not log patient names, email addresses, phone numbers, hashed identifiers, service names, treatment details, clinical text, or full booking records. Use opaque request IDs, tenant IDs where approved, route, actor, decision, reason code, and timestamp. A generic conversion event should remain generic and should not be reconstructed from debug data.

Log class Purpose Control
Security audit Who attempted which action and result Restricted access and review
Operational Health, latency, retries, failures Redaction and short retention
Deployment Artifact, configuration, owner, date Change approval
Incident Containment and recovery evidence Case scope and legal review

Compare regional KMS keys, build and artifact controls, and authenticated jobs.

Request, data, key, and identity path

Redact before writing to the logging API. Application code should construct a structured event from an allowlist, not serialize an entire request or database row. The logging identity should be able to write approved events but not read all tenant data. Review exception handlers, validation failures, queue messages, traces, and support exports.

Use trusted tenant context and home region. A client-supplied identifier should not become an unrestricted log field. Keep region, key, and sink selection in server-side configuration. Separate log reader, administrator, exporter, and incident roles. Test support access and export as aggressively as application access.

A generic conversion record may use approved event type, event time, currency, value, and opaque reference. Do not send patient names, email addresses, phone numbers, hashed identifiers, service names, treatment details, or clinical text to advertising systems or logs. Logging a forbidden value is still a disclosure even when the production upload is disabled.

request
  -> allowlist and redaction
  -> structured security or operational event
  -> regional log bucket
  -> restricted reader and review
  -> approved export or archive

Jobs, audit, backup, and failure handling

Retention is meaningful only when logs are complete, protected, and reviewable. Test authentication denial, tenant mismatch, key failure, queue retry, backup restore, export, support access, policy change, and deployment. Confirm each event contains enough evidence without carrying the source record.

Review log sinks, buckets, exports, alerts, traces, error reports, and debugging tools. A short operational log may be appropriate, while security evidence may require longer retention. Set each class from the risk analysis, contract, incident need, and applicable law. Do not copy all classes into one indefinite bucket.

Access review should identify who can read, change retention, create sinks, export, delete, or bypass redaction. Test a role that should see a security event but not sensitive data, and a support role that should not read audit evidence without approval. Keep change records for retention policy and sink changes.

Back up critical audit evidence if the incident plan requires it, then test restore, location, key, access, and deletion. A second copy creates another path and cost. Document whether exports are immutable, how legal holds apply, and who owns them.

Cost and proof gate

Logging cost follows volume and retention, while risk follows content and access. Use Cloud Logging Pricing for ingestion and retention estimates. Add exports, storage, keys, archive, alerts, support, and regional duplication. Label estimates with event rate, field size, retention, region, and date.

  • Use structured allowlists and redaction before emission.
  • Separate audit, operational, debug, deployment, and incident classes.
  • Restrict readers, exporters, retention administrators, and support.
  • Test sinks, exports, restore, deletion, and regional location.
  • Recalculate pricing after traffic or retention changes.

Logging audit proof

Run a synthetic event through every relevant path.

  1. Trigger allowed and denied tenant actions.
  2. Inspect emitted fields for prohibited content and unnecessary identifiers.
  3. Verify structured audit event, operational event, trace, error, and queue behavior.
  4. Test reader, exporter, administrator, support, and incident roles.
  5. Change retention and sink policy with approval and audit.
  6. Restore a required archive and verify key, region, and access.
  7. Delete a test export and preserve only policy-required evidence.

The result should show what audit evidence exists, how it is protected, and what the system deliberately does not retain. A long retention setting cannot compensate for unsafe log content.

Build a log-field contract that developers can test. For every event, list allowed fields, prohibited fields, tenant scope, principal, action, decision, reason, timestamp, location, retention, reader, export, and deletion owner. Use an allowlist serializer and a test fixture that intentionally includes sensitive-looking fields. The test should fail when those fields reach any log, trace, error, queue, or notification.

Review retention as a set of classes rather than one number. Security audit evidence, operational events, debug output, deployment records, incident artifacts, and exported archives have different purposes. A long retention period can increase cost and exposure. A short period can weaken an investigation. Let risk, contract, and operational need decide, and date the decision.

Access review should include log readers, sink administrators, retention administrators, exporters, support, incident responders, and backup operators. Test that a reader can investigate a denial without reading a full document. Test that an exporter cannot create a global copy without approval. Inspect actual sink and archive locations, not only project labels.

Run the proof after schema, runtime, job, key, or logging changes. The authenticated job article shows why a scheduled worker needs its own audit path. Recheck pricing when event volume, retention, exports, or region changes. The final claim should distinguish available evidence from missing evidence.

A good audit record says what happened, who decided, what data class was involved, and what action followed. It does not need to copy the source record. This discipline keeps evidence useful while reducing the chance that logs become a second uncontrolled database.

Frequently asked questions

Should every log be kept for six years?

Do not assume that. Required documentation, application logs, debug data, and audit evidence can have different retention needs. Set each class from risk, contract, operational, and legal review.

Can redaction happen after logging?

Prefer redaction before emission. A later filter may leave copies in error reports, traces, exports, or backups. Test all sinks and secondary systems.

Who should read audit logs?

Only approved roles with a business need. Separate readers, exporters, retention administrators, support, and incident roles, then test access and review.

Does a covered logging product make logs safe?

No. Provider scope does not choose fields, roles, retention, location, exports, or application behavior. Those controls remain customer work.

References

Google Cloud KMS and Regional Keys for Protected Data

Short answer: Google Cloud KMS regional key design should align key location, service identity, rotation, backups, regional endpoints, and administrator access with the protected data boundary. As of 2026-08-15, Google Cloud publishes KMS pricing, regional endpoint and resource-location guidance, and covered-product scope. A key location or encryption setting does not replace tenant authorization or a complete risk analysis.

GCP service fit and regional boundary

KMS can support a regional encryption boundary when the rest of the data path respects it. Google Cloud KMS Pricing describes key storage and operations. Regional Endpoints and Resource Locations guidance describes location controls. The HIPAA page provides provider and shared-responsibility context. These documents support evidence collection, not a platform guarantee.

Assign tenant home region before the first protected write. Keep database, files, logs, backups, queues, secrets, and keys in that zone unless the customer and counsel approve a different recovery or transfer path. A global control plane should hold only opaque tenant and deployment metadata. Do not use a browser-selected region or key name as authority.

Key granularity should follow data class, region, role, recovery, and deletion requirements. One key per record is rarely a useful default. One global key may be too broad for a regional policy. Document the reason for the chosen topology, the owner, and the failure behavior when the key is disabled or unavailable.

Key concern Question Evidence
Location Where is the key and where can it be used? Key and resource inventory
Identity Which service can encrypt or decrypt? Role policy and denied calls
Lifecycle How are rotation, disable, and destruction handled? Lifecycle runbook and test
Recovery Which key and region serve backup restore? Isolated restore evidence

Compare AWS KMS architecture, Cloud Run home zones, and logging retention and audit evidence.

Request, data, key, and identity path

Authorize the data operation before the key operation. Authenticate, resolve tenant membership and home region, select the approved service and key, and then encrypt or decrypt. A role that can use a key should not automatically be able to read every tenant record. A key policy should not be the only membership control.

Separate application service identity, deployment identity, key administrator, backup operator, restore operator, support, and emergency access. Use regional endpoints where supported and document any global control-plane action. Test a request that supplies another tenant, another region, another key, or a missing identity context.

Keep sensitive content out of key aliases, labels, logs, error messages, and build configuration. A generic conversion record may use approved event type, time, currency, value, and opaque reference. Do not send patient names, email addresses, phone numbers, hashed identifiers, service names, treatment details, or clinical text to advertising systems.

tenant membership
  -> immutable home region
  -> regional service and key selection
  -> approved encrypt or decrypt operation
  -> redacted audit event
  -> regional backup and restore

Jobs, audit, backup, and failure handling

Key design is proven by failure behavior. Test wrong region, missing grant, expired identity, disabled key, rotation transition, backup restore, queue retry, and emergency access. The application should stop safely and expose a reason code without returning the protected value.

Rotation needs a complete lifecycle. Create synthetic data before and after rotation, read both through the normal role, and attempt denied access with another role. Verify that backups and restore can access the intended key without granting broad database permissions. Record who approved the change.

Regional endpoint controls help reduce accidental location paths, but they do not fix a global log sink or an unreviewed support session. Inspect keys, logs, queues, backups, files, and monitoring. Audit key-policy changes, grants, decrypt attempts, exports, restores, and emergency use without copying full records.

Run a restore drill in the approved region. Reapply membership, row or document policies, keys, and support restrictions before reading. Delete the synthetic copy according to policy. If recovery requires another region, record the transfer and contract gate rather than hiding it under disaster recovery.

Cost and proof gate

KMS pricing is usually one line; key operations and review are the larger design surface. Use the current KMS Pricing page for storage and operations. Add regional keys, encrypt and decrypt calls, grants, logs, backups, endpoints, support, and test environments. Label estimates with region, workload, retention, and date.

  • Choose key topology from region, data class, and access role.
  • Separate use from administration and emergency access.
  • Test rotation, disable, denial, backup, restore, and deletion.
  • Check regional endpoint and resource-location controls.
  • Recalculate current key and operation pricing before launch.

Regional key proof checklist

Use synthetic data to test the full lifecycle.

  1. Create a synthetic tenant in the approved region.
  2. Encrypt and decrypt with the application identity.
  3. Attempt wrong-tenant, wrong-region, and support-role access.
  4. Rotate and disable the key, then inspect safe failure.
  5. Back up and restore with separate recovery identity.
  6. Inspect logs, queues, aliases, labels, and endpoints for leakage.
  7. Review owner, administrator, grants, and emergency approval.

The conclusion should state which key actions are proven, which operations remain application-enforced, and which regional or transfer questions are open.

Use a lifecycle matrix for each key class. Record owner, administrators, services, regions, rotation, grants, backup, restore, disable, destruction, emergency access, audit, and cost. Review it after adding a data store or recovery copy. A key that is regional while its backup or service identity is global does not satisfy the intended boundary.

Test service identity and regional endpoint together. A missing grant should deny without returning data. A wrong region should fail before a write. A disabled key should alert and stop safely. A rotated key should preserve approved reads for old records and use the new key for new records. A restore should not grant the application broad key administration.

Keep labels, aliases, log fields, and error messages free of sensitive content. Generic conversion records stay limited to approved event type, time, currency, value, and opaque reference. Do not place patient, contact, service, treatment, or clinical details into key metadata. See logging retention and redaction for the secondary evidence path.

Price key storage and operations as estimates, then add rotation, grants, backups, logs, endpoints, support, and proof work. Recheck current pricing and location guidance before a new region or tenant is added. Document exceptions rather than silently sharing a key across zones.

Frequently asked questions

Should each region have a separate key?

Choose from the data and recovery boundary, access roles, deletion, and operational burden. A regional design often benefits from regional keys, but the exact topology needs evidence.

Does encryption establish compliance?

No. It is one technical control. Authorization, risk analysis, agreements, logging, backups, incident response, and minimum necessary use remain separate.

What is the first KMS test?

Encrypt and decrypt synthetic data through the normal role, then deny wrong region, wrong tenant, support, expired identity, and disabled-key paths. Inspect logs and restore.

Why do regional endpoints matter?

They can help constrain control-plane access and resource location where supported. They do not automatically constrain application routing, logs, backups, support, or data exports.

References

Cloud Build and Artifact Registry Costs for Deployments

Short answer: Cloud Build and Artifact Registry costs should be separated from application traffic and modeled from build minutes, image storage, retention, transfer, and deployment frequency. As of 2026-08-15, Google Cloud publishes pricing for Cloud Build, Artifact Registry, and Cloud Run. A low build bill does not prove image governance, secret handling, regional policy, or deployment safety.

GCP service fit and regional boundary

Build infrastructure supports a deployment but does not make the application approved. Cloud Build Pricing describes build-minute inputs, Artifact Registry Pricing describes artifact storage and transfer, and Cloud Run Pricing describes runtime inputs. Use these pages to model deployment cost and then review project, region, identity, secrets, logs, and source controls.

Keep production artifacts in an approved repository and region. Decide whether images, build logs, caches, provenance records, and rollback versions are protected data or operational metadata. Do not put patient, appointment, service, click, or conversion records into build arguments, image layers, test fixtures, logs, or commit messages.

Use separate projects or repositories for development and production where the risk analysis requires it. A build identity should be able to publish an image without reading production data. A deployment identity should pull the approved digest without changing source or artifact policy. Retention should be deliberate, not an accidental result of every deployment.

Cost or control Question Evidence
Build How many minutes, workers, and retries run? Build history and estimate
Artifact How many images, layers, tags, and regions remain? Repository inventory
Runtime What deployment traffic and resources follow? Cloud Run estimate
Governance Who can publish, deploy, delete, or restore? Role review and test

Compare Cloud Run migration, logging retention, and regional KMS keys.

Request, data, key, and identity path

Keep customer data out of the build path unless the contract and control design explicitly require it. Use synthetic fixtures for tests. Build from source, inject secrets at runtime through approved mechanisms, and prevent environment snapshots or error output from revealing values.

Deployment identity should verify image digest, project, region, service account, and configuration before release. A tag can move; a reviewed digest gives a more stable release reference. Rollback should select an approved earlier artifact without restoring old protected data into a build log or test environment.

If an application sends a generic conversion event, keep its approved event type, time, currency, value, and opaque reference outside build logs. Never send patient names, email addresses, phone numbers, hashed identifiers, service names, treatment details, or clinical text to advertising systems or CI telemetry.

source review
  -> isolated build identity
  -> artifact repository and digest
  -> deployment approval
  -> Cloud Run service and runtime secrets
  -> regional logs and rollback record

Jobs, audit, backup, and failure handling

Build failures can become data leaks when logs capture too much. Test failed dependency install, secret access, test assertion, deployment, rollback, and artifact pull. Inspect build logs, caches, test reports, image layers, and notification payloads. Remove request data from fixtures and redact error output.

Audit source change, build, artifact publish, deployment, rollback, deletion, restore, role change, and approval. Keep audit events minimum necessary. Build metadata can include branch and commit references without including customer data. Use separate roles for developer, builder, publisher, deployer, and administrator.

Artifact retention is an operational decision. Keep enough versions to recover and investigate, then delete unneeded images and layers according to policy. Test deletion, legal hold, backup, and restore. A repository with many stale images increases both cost and review surface.

Regional resources need a location test. Verify repository, build worker, logs, keys, runtime, and backups. A global build trigger may be acceptable when it carries no protected data, but document the control-plane path and remote operator access.

Cost and proof gate

Model deployment cost from frequency and retention, not traffic alone. Use Cloud Build Pricing for build minutes, Artifact Registry Pricing for storage and transfer, and Cloud Run Pricing for runtime. Add logs, keys, secrets, DNS, support, egress, and regional duplication. Label estimates with workload, region, retention, and date.

  • Count builds, retries, workers, and average duration.
  • Count images, tags, layers, regions, and retention.
  • Separate deployment traffic from application traffic.
  • Test identity, digest, rollback, secret, and log boundaries.
  • Recheck current pricing before quoting.

Deployment proof checklist

Approve the pipeline only after a synthetic release passes.

  1. Build from a reviewed source change with synthetic fixtures.
  2. Inspect logs, test reports, caches, and image layers for data leakage.
  3. Publish an immutable artifact reference with the least-privilege identity.
  4. Deploy to the approved region and verify service configuration.
  5. Roll back and restore the previous approved artifact.
  6. Delete an unneeded artifact and verify retention evidence.
  7. Recalculate build and storage estimates.

The final record should state what the pipeline proves and what it excludes. Build and registry controls strengthen release evidence; they do not establish application compliance.

Artifact governance should include a release inventory: source revision, build identity, worker, dependencies, image digest, project, region, deployment identity, runtime secrets, and rollback owner. Keep test fixtures synthetic and prevent customer data from entering image layers or build logs. A release can be reproducible without carrying a protected record through the pipeline.

Retention should match recovery and investigation. Keep enough approved versions to roll back, then delete old images, tags, layers, caches, logs, and exports according to policy. Review legal hold and customer offboarding separately. A repository that grows without ownership creates cost and access risk even when application traffic is low.

Run a failed build and a failed deploy. Inspect error output, test reports, notifications, artifact permissions, secret references, and rollback. Then run a synthetic production smoke check. The Cloud Run migration review explains why a running container is only one part of the release proof.

Cost estimates should state build frequency, average duration, retries, worker type, artifact count, image size, layer reuse, retention, transfer, region, and runtime. Recalculate after release cadence or image architecture changes. Do not treat a free build allowance as a permanent price or a security control.

Frequently asked questions

Are build minutes the main deployment cost?

Not always. Image storage, layers, retention, transfer, logs, keys, runtime, and regional resources can matter. Model each line with current provider pricing.

Should protected data be used in CI fixtures?

Use synthetic data by default. If a customer-approved exception exists, document the contract, controls, access, retention, and deletion before placing it in a build path.

Does an image digest prove a safe release?

It gives a stable artifact reference. The release still needs source review, secret separation, deployment identity, region, runtime authorization, logs, rollback, and data tests.

What should be rechecked before a cost quote?

Recheck build rates, artifact storage and transfer, Cloud Run rates, regional multipliers, retention, build frequency, and exclusions. Label the result as a dated estimate.

References

Cloud SQL High Availability: Cost and Production Tradeoffs

Short answer: Cloud SQL high availability should be priced as an uptime and recovery decision, not as a simple instance multiplier. As of 2026-08-15, Google Cloud publishes Cloud SQL pricing, operational guidelines, and covered-product scope. A single-zone price can be a useful reference, but it does not prove production availability, backup recovery, tenant isolation, or contract readiness.

GCP service fit and regional boundary

HA is justified by recovery requirements, not by the word healthcare alone. Cloud SQL Pricing describes instance, storage, and availability cost inputs. Cloud SQL Operational Guidelines provide production considerations and limitations. Google Cloud’s HIPAA page defines provider scope and shared responsibility. Together they support a planning comparison, not an automatic production recommendation.

Write the recovery objective first: acceptable downtime, data-loss window, restore source, operator, region, and tested procedure. Then compare single-zone reference pricing with HA and any required replicas. A lower monthly estimate may be unsuitable if it cannot meet the customer’s recovery contract.

Keep the location boundary explicit. Database, Cloud Run, files, keys, logs, queues, backups, and support access should follow the tenant home region. HA inside an approved geography can be different from cross-region replication. Do not make a region claim based only on a database setting.

Dimension Single-zone reference HA production question
Compute One instance path What capacity and failover resources are required?
Availability More interruption exposure What failure is covered and tested?
Recovery Backup and restore procedure What is the target time and data-loss window?
Cost Lower reference floor What fixed and variable resources are added?

Compare Cloud SQL RLS, Firestore proof, and regional Cloud Run deployment.

Request, data, key, and identity path

High availability does not change authorization. Authenticate, resolve membership and home region, authorize the request, and then query the database. Test failover and connection retry without losing tenant context. A reconnect that uses a broad role or stale session can create a security failure during an availability event.

Use database-enforced policies where appropriate and keep application membership checks. Separate application, migration, report, support, backup, and restore identities. Verify that failover preserves key access, audit, logs, backups, and region policy.

Keep data minimum necessary. A generic conversion record may use approved event type, time, currency, value, and opaque reference. Do not send patient names, email addresses, phone numbers, hashed identifiers, service names, treatment details, or clinical text to advertising systems. HA does not authorize external disclosure.

request -> membership and region
        -> HA database endpoint
        -> tenant policy and query
        -> redacted audit
        -> backup and restore evidence

Jobs, audit, backup, and failure handling

Measure both planned failover and unplanned failure. Run a synthetic workload through restart, failover, connection retry, transaction rollback, backup, restore, and regional restriction. Observe query completion, duplicate writes, queue behavior, logs, alerts, and tenant authorization.

Backups are not a substitute for HA. HA may reduce interruption, while backups address corruption, deletion, and recovery. Test a restore into an isolated approved location, reapply keys and roles, and verify tenant access before reading. Record restore duration and any manual step.

Audit failover, role change, export, restore, support, key use, and policy change. Do not log full records. Ensure monitoring and alerting do not create a global data path. A working database connection says nothing about whether logs or backups comply with the same region policy.

Scheduled jobs can affect both cost and reliability. Inventory reports, cleanup, queues, health checks, and migrations. A job that retries after failover may duplicate writes or keep an instance active. Test idempotency and record the workload assumption.

Cost and proof gate

Use three scenarios: reference single-zone, required HA, and incident recovery. Cloud SQL pricing is volatile. Include instance class, edition, storage, backups, traffic, logs, keys, monitoring, support, and regional resources. Label estimates with date, region, utilization, and exclusions.

  • Do not use single-zone price as a production promise.
  • Price backups and recovery separately from HA.
  • Include connection, job, log, and key operations.
  • Measure failover, restore, retry, and duplicate-write behavior.
  • Reopen operational guidelines before launch.

HA proof checklist

Approve the production floor only after an observed failure test.

  1. Document uptime and recovery objectives.
  2. Run normal and burst synthetic requests.
  3. Trigger planned failover and observe authorization and transaction behavior.
  4. Simulate connection loss, retry, duplicate event, and rollback.
  5. Restore a backup and verify region, key, role, and tenant policy.
  6. Inspect logs, alerts, support, and export paths.
  7. Recalculate current price assumptions and record owner approval.

Keep the decision honest: HA can improve availability, but it does not create tenant isolation or legal approval. Those are separate gates.

Build the HA decision around a failure table. List instance failure, zone failure, connection loss, transaction rollback, storage growth, key outage, backup corruption, operator mistake, and regional disaster. For each, name expected behavior, recovery target, data-loss tolerance, owner, evidence, and cost. A high-availability flag is only one row in that table.

Do not compare a production HA configuration with a development single-zone configuration as if they supplied the same service. Use the single-zone row to understand a lower reference floor, then add availability, backups, monitoring, support, testing, and recovery. If a customer contract requires a target not met by the reference configuration, it is not an acceptable production option.

Test tenant context through failover and reconnect. A connection pool can retain stale state, while a retry can repeat a write. Use synthetic tenants and inspect database policies, logs, queue messages, and audit records. The logging retention review keeps the evidence path visible when the database fails over.

Refresh the estimate when region, edition, instance, storage, schedule, traffic, or tenant count changes. State taxes, support, transfer, and engineering exclusions. Cloud cost is a planning input; recovery and security evidence are separate acceptance gates.

Frequently asked questions

Is a single-zone Cloud SQL price enough for production planning?

It can be a reference, not a conclusion. Compare recovery objectives, availability, backups, support, and operational risk before selecting the production configuration.

Does HA replace backups?

No. HA addresses some availability failures. Backups and restore address deletion, corruption, retention, and recovery. Test both.

Can HA cause security issues?

Failover and reconnect paths can expose stale tenant context, broad roles, duplicate writes, or unreviewed logs. Test those paths with synthetic tenants.

What should a price estimate state?

State region, edition, instance, availability, storage, backup, traffic, logs, keys, support, utilization, exclusions, and retrieval date. Label it as an estimate.

References

Cloud SQL PostgreSQL and Row-Level Security for Tenants

Short answer: Cloud SQL PostgreSQL row-level security can provide a database-enforced backstop for tenant access, but it does not replace server-side membership, role design, migrations, reports, backups, or support controls. As of 2026-08-15, Google Cloud documents Cloud SQL editions, covered-product scope, and operational guidance. Test the policy under every application and privileged path before making a stronger claim.

GCP service fit and regional boundary

Cloud SQL is useful when the workload needs relational behavior and an enforceable database policy layer. Google Cloud’s Cloud SQL Editions page describes editions and capabilities, while the HIPAA page sets provider scope and shared responsibility. Operational guidance describes production considerations. These sources support a technical candidate review, not a deployment guarantee.

Start with the tenant contract: every row belongs to a tenant, every request has a trusted membership, and a database session receives a server-derived tenant context. The policy should deny rows when the context is missing, not return all rows by default. The application still checks membership, role, and region before opening the transaction.

Regional design remains separate. Keep Cloud SQL, Cloud Run, files, keys, logs, queues, backups, and support paths in the approved home zone. A database policy cannot stop an export job, backup operator, or global log sink from crossing a boundary.

Layer Control Proof
Application Membership and role check Wrong-tenant request denial
Database Row policy on tenant context Missing and changed context tests
Operations Admin, report, backup, and restore roles Privileged-path review
Region Data and recovery location Resource and restore evidence

Compare RLS versus application filters, Firestore Rules and Admin SDK, and Cloud SQL high availability cost.

Request, data, key, and identity path

Set tenant context only from trusted server-side membership. Do not derive it from a browser parameter or an unverified JWT claim. The server authenticates, resolves membership and home region, begins a transaction, sets a local tenant context, and performs the query. The policy should fail closed when that context is missing.

Connection pooling needs a focused test. A session setting left behind by a prior request can expose the wrong tenant, while a missing setting can expose no rows or, in a weak policy, all rows. Use transaction-scoped context where possible, reset state, and test concurrent requests with synthetic tenants.

Keep stored data minimum necessary. A generic conversion record may use approved event type, time, currency, value, and opaque reference. Do not send patient names, email addresses, phone numbers, hashed identifiers, service names, treatment details, or clinical text to advertising systems. RLS protects records in the database, not an external disclosure.

authenticated request
  -> membership and home region
  -> transaction-scoped tenant context
  -> application query plus row policy
  -> redacted result and audit event

Jobs, audit, backup, and failure handling

RLS proof must include every identity that can connect. Test ordinary application role, report role, migration role, support role, backup and restore role, and database administrator. A privileged role may bypass row policies by design, so its use needs separate approval, logging, and operational limits.

Run wrong-tenant reads and writes, missing context, changed context, connection reuse, batch reports, exports, direct SQL, migrations, and restore. Use two synthetic tenants and record which layer denied each operation. A successful web request proves only one route.

Audit policy changes, role grants, context-setting failures, exports, restores, support access, and administrative reads. Keep full row data out of logs. Backups and restored databases need policy installation and role review before any application read. Test deletion and retention of test copies.

Operational guidance and availability choices affect recovery. A single-zone development setting may be a cost reference rather than a production decision. Test backup, restore, failover, migration, and key access under the selected edition and region.

Cost and proof gate

Price Cloud SQL with the availability and proof the workload actually needs. Google Cloud pricing can change by edition, instance, storage, backups, network, and region. Add Cloud Run, logs, keys, secrets, and support. Mark estimates with date and assumptions. Do not use a small instance estimate to imply production suitability or legal sufficiency.

  • Choose edition and availability from recovery objectives.
  • Implement application membership and database policy together.
  • Separate privileged roles and review bypass paths.
  • Measure connection pool, query, report, backup, and restore behavior.
  • Recheck current Cloud SQL documentation before production.

RLS proof checklist

Require a negative test that would expose a missing policy.

  1. Create records for two synthetic tenants.
  2. Read and write as each tenant through the application.
  3. Remove tenant context and confirm denial or empty scope.
  4. Change context and confirm the wrong tenant is denied.
  5. Test pooled connections, reports, exports, migrations, support, backup, and restore.
  6. Review roles that can bypass policies.
  7. Inspect logs, key access, locations, and incident evidence.

State the result precisely: row policy provides a database backstop for tested roles and queries; membership and privileged operations remain separate controls. That is stronger and more useful than calling the database universally isolated.

Policy design should be reviewed beside schema and connection behavior. Name the tenant column, context source, transaction boundary, policy for read, insert, update, and delete, and behavior when context is absent. Review views, functions, indexes, reports, migrations, and background workers. A new database caller is a new authorization path, even if it uses the same table.

Run concurrency tests with two synthetic tenants using a connection pool. Start requests close together, switch tenant context, fail one transaction, retry another, and inspect results. Then test a report role, migration role, support role, backup restore, and direct connection. Capture the role and context for every result. Do not accept an RLS claim based only on a static policy review.

RLS can support a strong database backstop, but it should be combined with minimum necessary data, audit, key, log, backup, and offboarding controls. A generic conversion payload remains a separate approval surface. Do not use a database query to justify sending patient name, email, phone, hashed identifier, service or treatment detail, or clinical text to an advertising destination.

Cost proof should include edition, instance, storage, backups, logs, keys, network, availability, support, migration, and test environments. Recheck current provider guidance when the database version or edition changes. Keep the acceptance sentence precise: tested roles and queries are protected by policy; untested privileged paths remain open risk.

Frequently asked questions

Does RLS replace application tenant filters?

No. Keep application membership and tenant checks. RLS is a backstop that can reduce the impact of a missed filter, but privileged roles, exports, reports, backups, and restores need separate controls.

What is the connection-pool risk?

A session can retain a prior tenant context or omit the current one. Use transaction-scoped context, reset state, and run concurrent synthetic tests across tenants.

Can an administrator bypass RLS?

Some privileged roles may have broader authority. Inventory those roles, restrict use, log access, and test support, migration, backup, and restore paths separately.

What should be checked before production?

Verify edition, region, availability, keys, backups, roles, application checks, row policy, queries, reports, exports, restore, logging, and the customer contract and counsel review.

References

Why Firestore Location Is a One-Time Architecture Decision

Short answer: Firestore database location is a one-time architecture decision because the selected location cannot simply be changed after creation. As of 2026-08-15, Google Cloud documents Firestore locations and covered-product scope, while the European Commission describes international-transfer safeguards. Choose tenant home zones before onboarding, and treat a region move as an export, import, approval, and deletion project.

GCP service fit and regional boundary

Choose Firestore location before creating the production database. Google’s Firestore Locations page describes available regional and multi-region choices and the consequences of the database location. Google Cloud’s HIPAA page provides provider scope and shared-responsibility context. The European Commission’s transfer guidance matters when EU data or remote access crosses the European Economic Area. None of these sources approves a particular tenant deployment.

Make home region a control-plane fact: tenant ID, region, deployment state, and billing reference. Keep patient, appointment, service, click, and conversion data out of that global record. Assign the region through an authorized server workflow before the first protected write, then reject changes through ordinary application paths.

Match Cloud Run, files, keys, logs, queues, backups, workers, and support policy to the same zone. A database in Europe with a globally replicated log or support export still has cross-border paths. A multi-region database may solve availability but conflict with a contract that promises one home region. The decision must name the requirement being served.

Decision Effect Required evidence
Location Sets database geography and migration path Tenant onboarding record
Service Must route to matching regional resources Route and resource inventory
Recovery Backups and restore need approved geography Restore drill and deletion check
Access Remote support may create transfer issues Role, contract, and transfer review

Compare Cloud Run home zones, Firestore database proof, and regional key design.

Request, data, key, and identity path

Route by immutable server configuration, never by client-selected location. Authenticate caller, resolve membership, load tenant home region, select the correct Firestore database or regional service, and authorize the operation. A request that supplies another region should fail before a read or write.

Use minimum necessary data in the regional store. A generic conversion record can contain an approved event type, time, currency, value, and opaque reference. Do not send patient names, email addresses, phone numbers, hashed identifiers, service names, treatment details, or clinical text to advertising systems. Region does not make a prohibited payload acceptable.

Keep keys, secrets, logs, backups, and workers in the same location policy. The Admin SDK or a server identity can bypass client rules, so membership and tenant authorization must remain explicit. Support and restore roles need separate approvals and audit. The application should expose no route that changes a tenant’s home region as a side effect.

authorized onboarding
  -> immutable tenant home region
  -> Firestore database created in chosen location
  -> regional service and key path
  -> server membership check
  -> protected document operation

Jobs, audit, backup, and failure handling

Immutability changes how failures are repaired. A wrong initial location may require export and import, data deletion verification, contract review, and a new database. Test onboarding rejection, wrong-region routing, backup, restore, export, support access, and deletion with synthetic tenants. Do not use a production move as the first location test.

Inspect scheduled jobs and queues. A background worker may read from a regional database and write to a global analytics destination. Logs and traces may use a default location. Key operations may be administered from another country. Record those paths and ask counsel whether remote access or transfer mechanisms are required.

Audit location assignment, attempted changes, exports, restores, support access, key changes, and privileged Admin SDK reads. Keep audit events minimum necessary. Retain documentation according to risk and contract; do not retain full records merely because the location cannot be changed.

Back up synthetic data, restore within the approved zone, inspect key and authorization behavior, and delete the test copy. If disaster recovery requires another geography, document that as a separate approved transfer design rather than hiding it under availability terminology.

Cost and proof gate

Location multiplies fixed cloud and operational decisions. Firestore Pricing should be rechecked for regional rates, reads, writes, indexes, storage, backups, and traffic. Add Cloud Run, logs, keys, queues, support, and regional duplication. Label estimates with date and workload.

  • Choose region before database creation.
  • Record tenant home region as immutable server state.
  • Reject client-selected or post-write region changes.
  • Keep backup, key, log, queue, and support paths in scope.
  • Price a region move as a migration, not a configuration toggle.

Location decision checklist

Run the proof before accepting a tenant.

  1. List approved tenant jurisdictions and home zones.
  2. Create a synthetic database in the selected location.
  3. Deploy regional service, key, log, queue, and backup paths.
  4. Test membership, wrong-region request, Admin SDK, export, restore, and support.
  5. Attempt an onboarding location change and verify the gate.
  6. Document transfer, recovery, deletion, and contract questions.
  7. Obtain customer and counsel approval before protected writes.

If the product cannot preserve the location contract, stop the migration. A new database or a different engine may be cheaper than a later unplanned relocation.

Make location assignment part of an approval gate rather than an infrastructure default. The onboarding record should name tenant jurisdiction, home region, database location, Cloud Run region, files, keys, logs, queues, backups, support countries, and recovery options. Reject onboarding when those resources cannot be provisioned consistently. It is cheaper to stop before the first write than to discover a location mismatch during migration.

A location move is a data project. Define export scope, encryption, transfer mechanism, import validation, record reconciliation, old database deletion, backup cleanup, log retention, and customer approval. Test the procedure with synthetic data. Do not treat a new database as a simple setting change, and do not leave the old copy active after the new path is accepted.

Keep location facts current. Provider regions, features, pricing, endpoint behavior, and transfer guidance can change. Reopen the source pages before a new tenant or region is sold. The Cloud SQL HA cost review shows why regional and recovery choices affect both margin and proof work.

Frequently asked questions

Can Firestore location be changed later?

Treat the initial location as immutable for architecture planning. A move should be handled as a controlled export and import with approval, reconciliation, deletion, and contract review.

Does an EU database prevent all transfers?

No. Remote support, logs, backups, keys, queues, and exports can still cross borders. Map access and data paths and apply the appropriate transfer safeguards.

Can a user choose a preferred region?

A user may request service, but only an authorized server workflow should assign a home region. The value must become immutable before protected data is written.

Does a BAA settle location questions?

No. A BAA is a contract boundary. Region, data flow, support access, backups, security controls, and other jurisdictional obligations remain separate.

References

Firestore for HIPAA Data: What a Database Proof Must Test

Short answer: A Firestore database proof must test query completeness, transactions, tenant authorization, exports, backups, restore, location, and server-side access before a migration decision. As of 2026-08-15, Google Cloud publishes Firestore pricing, location behavior, and covered-product scope. A BAA or database label does not prove that application and administrative paths enforce the intended boundary.

GCP service fit and regional boundary

Firestore is a candidate only after the data contract survives a vertical-slice proof. Google Cloud’s HIPAA page describes covered products and shared responsibility. Firestore Locations describes database location. Firestore Pricing describes reads, writes, storage, indexes, and backups. Those sources support a bounded technical evaluation, not a claim that the database is approved for every application use.

List the actual queries: tenant membership, intake, booking state, idempotent outbox, report, export, and support lookup. Record query filters, ordering, indexes, transaction boundaries, expected cardinality, and failure behavior. A document model can be attractive for a Mongo-like workload, but a migration still changes query semantics, reports, constraints, and recovery.

Decide location before creating the database. Firestore location is a foundational choice. Match Cloud Run, files, keys, logs, backups, queues, and support policy to the tenant home zone. Do not add protected records to a database whose location or backup behavior is not approved.

Proof area Question Pass evidence
Queries Do all required reads return complete, scoped results? Query parity and negative tests
Writes Do transactions and retries preserve state? Idempotency and failure tests
Authorization Do server and client paths enforce membership? Denied access matrix
Recovery Can export, backup, and restore be controlled? Isolated restore evidence

Compare Firestore Rules and Admin SDK, Firestore location immutability, and Cloud SQL PostgreSQL RLS.

Request, data, key, and identity path

Server-side membership must authorize every protected read and write. Client Firestore Security Rules govern client SDK paths, but a server using Admin SDK or another privileged path still needs application membership checks. Resolve tenant and home region server-side. Do not trust a document path or client-supplied tenant field as proof.

Model documents so the authorization context is visible and testable. A tenant path can support a rule, but an export job, scheduled report, Admin SDK worker, backup, restore, and support tool may not use the client path. Test each identity and operation. A successful client read is not evidence for server-side access.

Keep the stored data minimum necessary. Generic event type, time, currency, value, and an opaque internal reference may support an approved conversion workflow. Do not send patient names, email addresses, phone numbers, hashed identifiers, service names, treatment details, or clinical text to advertising destinations. Store additional fields only when the customer contract and risk analysis justify them.

authenticated request
  -> server membership and home region
  -> Firestore query or transaction
  -> authorized document scope
  -> redacted audit and queue event

Jobs, audit, backup, and failure handling

Database proof needs adversarial paths. Create two synthetic tenants and run client reads, server reads, writes, updates, deletes, transactions, batches, reports, exports, backup, restore, and support actions. Attempt wrong-tenant path substitution, missing membership, expired identity, changed region, and a privileged Admin SDK call.

Transactions and retries require measured behavior. Run a failure after one write, a duplicate event, a partial batch, an unavailable dependency, and a timeout. Compare resulting documents with the source contract. Confirm that idempotency keys do not leak across tenants or create duplicate outbound events.

Inspect logs, indexes, errors, backup metadata, and exports. Do not copy full documents into logs. Test restore in an isolated project or database, reapply membership, verify location and keys, and delete the synthetic copy. A provider backup feature is not proof that the restored application is authorized.

Cost is part of proof. Reads, writes, index entries, storage, backups, traffic, and named databases can change the estimate. Run representative queries and record current pricing assumptions. Do not use free-quota arithmetic as a production guarantee.

Cost and proof gate

Choose Firestore only when query and tenancy proof pass together. Use Firestore Pricing for current request, storage, index, and backup inputs. Add Cloud Run, logs, keys, secrets, backups, support, and regional duplication. Label numbers as estimates with workload, region, and date.

  • Freeze source query and transaction contracts.
  • Build one vertical slice with synthetic tenants.
  • Test client, server, Admin SDK, export, restore, and support roles.
  • Measure reads, writes, indexes, storage, backups, and retries.
  • Keep a PostgreSQL fallback if proof or margin fails.

Firestore proof checklist

Do not approve a database from a happy-path demo.

  1. Create synthetic tenant A and tenant B records.
  2. Run every required query and compare completeness with the current contract.
  3. Test wrong-tenant reads and writes through client and server paths.
  4. Run transaction, batch, retry, export, backup, and restore tests.
  5. Inspect Admin SDK roles, logs, keys, location, and support access.
  6. Measure current cost assumptions and record the date.
  7. Obtain counsel and customer approval before protected migration.

The final decision should name missing queries, unproved privileged paths, and any data-location exception. If the database cannot prove the contract, choose another design or defer the migration.

Build the proof from the current source contract. List each collection, document, index, query, transaction, report, export, backup, restore, role, and event. For every item, write expected result for tenant A, expected denial for tenant B, retry behavior, audit field, location, retention, and cost input. If a query is not expressible or requires a broad Admin SDK path, mark it as a migration gap.

Run parity checks with synthetic data that includes empty results, duplicate events, concurrent updates, deleted records, pagination, time ranges, report filters, and failed dependencies. Compare record counts, state transitions, and idempotency with the existing contract. A query that works for one document can fail when an index, report, or export changes the scope.

Review Firestore Rules and server identity independently. Client tests should prove Rules behavior. Server tests should prove membership, tenant, region, role, and collection scope. Restore tests should install policies before reading. Support and export tests should use separate roles. Do not let a provider feature list substitute for these checks.

Cost proof should use measured representative operations. Count reads, writes, index entries, storage, backups, retries, exports, logs, keys, Cloud Run calls, and regional resources. Recalculate when query shape or tenant count changes. Keep a PostgreSQL fallback for contracts that require relational constraints or database-enforced row policy.

The final gate should name what passed, what failed, what remains application-enforced, and which legal or contract question is open. It should not call Firestore compliant because a sample read and write succeeded.

Frequently asked questions

Do Firestore Rules protect Admin SDK reads?

Do not assume that. Server-side Admin SDK access is a privileged application path and still needs membership, tenant, role, and export controls.

What is the most important migration test?

Run a complete vertical slice with real query shapes, transactions, wrong-tenant denials, retries, reports, exports, backups, and restore. A single document demo is not enough.

Does Firestore pricing prove the database is affordable?

No. Add indexes, storage, backups, logs, keys, traffic, regional resources, support, and migration work. Recalculate using measured queries and current provider rates.

When should PostgreSQL be tested?

Test it when the workload needs relational reporting, constraints, transactions, or database-enforced row policies. Compare contracts and proof results rather than choosing from price alone.

References

Cloud Run Custom Domains: When a Load Balancer Matters

Short answer: A Cloud Run custom domain decision should compare direct domain mapping with a production load-balancer path against region, ingress control, certificates, logging, failover, and fixed cost. As of 2026-08-15, Google Cloud documents custom-domain options, Cloud Run pricing, and covered-product scope. Neither a working DNS record nor a load balancer proves that the application handles protected data safely.

GCP service fit and regional boundary

Cloud Run custom-domain options are deployment mechanisms, not compliance boundaries. Google’s custom-domain documentation describes domain mapping and other ingress options. Cloud Run pricing supplies request and resource cost inputs, and the Google Cloud HIPAA page describes provider scope and shared responsibility. Compare those facts with the application’s need for WAF, centralized policy, regional routing, certificates, logs, and operational ownership.

Direct mapping may be adequate for a narrow route when its documented limitations are acceptable. A load balancer may be justified when the design needs centralized ingress, routing, policy, or a controlled origin. The choice must be current because product status, regional availability, and pricing can change. Record the option, date, region, and unresolved feature question.

Set the region before binding a domain. The hostname should route by tenant configuration and home region, not by patient IP geolocation or a client-selected parameter. Keep backend, database, files, keys, logs, queues, backups, and support access aligned with that region.

Ingress question Direct mapping Load balancer path
Domain binding Documented mapping flow Forwarding rule and backend configuration
Policy Cloud Run and app controls Central edge policy plus app controls
Cost Mapping and service assumptions Forwarding rule, traffic, and service assumptions
Proof Origin and route tests Edge, origin, failover, and route tests

For region design, see Cloud Run home zones. For runtime migration, read bounded Cloud Run migration, and for protected service scope compare Google Cloud covered products.

Request, data, key, and identity path

The domain path must preserve identity and tenant checks. Trace DNS, certificate, edge or mapping, Cloud Run service, authentication, membership, database, key, log, and backup. Test direct service URLs and alternate hostnames. A load balancer cannot protect an origin that remains publicly reachable unless the configuration and application enforce the intended path.

Do not place tenant or region authority in the hostname alone. The server should resolve membership and immutable home region, then reject a mismatch. A public route can be recognizable by host while still requiring an application-level identity check.

Minimize request data. A generic conversion record may use approved event type, time, currency, value, and an opaque internal reference. Do not send patient names, email addresses, phone numbers, hashed identifiers, service names, treatment details, or clinical text to advertising systems. An ingress feature does not change that data rule.

DNS and certificate
  -> mapping or load balancer
  -> Cloud Run origin
  -> membership and tenant check
  -> approved database and regional logs

Jobs, audit, backup, and failure handling

Test edge failure and origin failure separately. Use expired certificates, wrong host, missing route, WAF or policy denial, direct-origin request, service timeout, backend error, and retry. Inspect error responses, access logs, traces, and queue records for unnecessary request content.

Audit edge policy changes, DNS changes, certificate changes, deployment changes, identity decisions, exports, restores, and support access. Keep logs minimum necessary. A centralized load balancer can simplify review, but it can also create a global logging path or a second region that needs approval.

Backups and support are independent of ingress. Verify that a support engineer cannot bypass tenant membership by calling a backend endpoint, and that restore data is only readable after the application policy is installed. Test a domain migration or rollback without leaving two active origins.

Use synthetic tenants and records. Verify that each home region routes to its intended service and data store, and that a wrong-region host is denied or redirected only through an approved policy. Record observed behavior and date it.

Cost and proof gate

A load balancer has a fixed cost floor that direct mapping may avoid, but cost is not the only axis. Use Cloud Run pricing and current ingress documentation to estimate forwarding rules, traffic, service requests, certificates, logs, monitoring, DNS, and regional duplication. Mark estimates with region and date.

  • List required ingress features and limitations.
  • Confirm current regional and product status.
  • Check direct origin reachability and alternate hostnames.
  • Include edge and backend logs in the data map.
  • Run domain, identity, region, failure, export, and restore tests.

Custom-domain proof checklist

Approve one ingress option only after the route and bypass tests pass.

  1. Bind a synthetic hostname in the approved region.
  2. Verify certificate, TLS, expected route, and tenant membership.
  3. Call the direct origin and alternate hostname and confirm the intended denial.
  4. Trigger edge and backend failures and inspect redacted logs.
  5. Test regional routing, queue, backup, restore, and support paths.
  6. Measure fixed and variable cost assumptions.
  7. Record provider status and legal questions for review.

A custom domain is a presentation and routing feature. The final decision should say what it controls and what remains application, database, identity, and contract work.

Ingress review should end in an explicit origin policy. Name the public hostname, expected edge, Cloud Run service, region, certificate owner, allowed methods, authentication, WAF or policy controls, and direct-origin behavior. If the origin must be private or reachable only through the edge, test that requirement instead of inferring it from DNS.

Compare domain mapping and load balancer options against operational evidence. A load balancer may centralize routing and policy while adding forwarding-rule, traffic, log, and regional costs. Direct mapping may reduce infrastructure but have limitations that matter for production. Product status and pricing are volatile, so date the decision and recheck before release.

Run a controlled hostname with synthetic data. Test normal route, wrong tenant, expired identity, certificate or DNS failure, direct origin, alternate host, backend timeout, rollback, logs, backup, and support. The same route should not expose a broad administrative endpoint because it happens to be behind a working certificate.

Keep customer and counsel review separate from technical proof. The edge proves a routing and policy behavior. It does not decide whether a data path, region, contract, or advertising event is permitted. See covered-product review for the provider and customer boundary.

Frequently asked questions

Is a load balancer required for every Cloud Run custom domain?

No universal answer applies. Compare documented mapping options, required edge controls, production routing, region, cost, and operational proof. Recheck current Google Cloud documentation before choosing.

Does a load balancer protect the backend?

Only if origin access and application authorization are configured and tested. An alternate direct origin, privileged job, or support path can bypass edge policy.

What costs should be estimated?

Include Cloud Run requests and resources, forwarding rules, traffic, certificates, DNS, logs, monitoring, keys, backups, and regional duplication. Label values as estimates with date and region.

What should be tested first?

Run a synthetic domain request, wrong-tenant request, direct-origin request, certificate or route failure, log inspection, regional route, backup, restore, and support access test.

References