Naming, provisioning, rotation, and best practices for bypass API keys
Bypass API keys (sk_*) are static secrets injected at the CloudFront edge.
When a request arrives from a trusted first-party origin (e.g., hydrofabric.lynker-spatial.com),
CloudFront injects the key automatically — no JWT required. For third-party integrations,
the key is passed in the X-API-Key header and validated by the Lambda origin.
Keys grant enterprise-level access to all protected tile routes
(/api/tiles/{source}/{z}/{x}/{y}) without per-request JWT validation.
They are not short-lived and must be rotated manually.
sk_* keys in public client-side code.
Browser apps should either use a server-side proxy that holds the key, or obtain
short-lived per-user Cognito tokens for direct tile requests.
| Pattern | Example | Use |
|---|---|---|
sk_{app}_{random} |
sk_nymesonet_3f4a2b9c |
Recommended — human-readable prefix + entropy suffix |
sk_{app} |
sk_nymesonet |
Weak — readable name only, guessable; avoid for production |
| Random opaque | f3b2c1d4a5e6f7a8b9c0 |
Max security — store friendly name as metadata separately |
Use one key per application or integration. Per-app keys make it trivial to revoke one client's access without impacting others and keep audit logs clean.
terraform/terraform.tfvars
terraform.tfvars is gitignored. In CI, inject via the
TF_VAR_bypass_api_keys environment variable (JSON array string).
The deploy script builds the Lambda image and applies Terraform. The CloudFront function and Lambda are updated atomically.
Pass the key in the X-API-Key header:
Or in code:
bypass_api_keys alongside the old key (both active).bypass_api_keys.| Single key | Per-app keys | |
|---|---|---|
| Operational overhead | Low | Medium |
| Blast radius on rotation/revocation | All clients | One client |
| Audit granularity | None | Per-app |
| Recommended for | Internal tooling only | All external integrations |
By default a bypass key grants access to all tile sources. To restrict a key to specific
sources, update the CloudFront viewer-request function
(cloudfront_function_forward_host.tf)
with a key-to-sources mapping and validate the source path segment against it.
Contact the platform team for an implementation example.