Skip to content

Secrets & Config Naming Convention

This service loads runtime configuration from AWS at import time via fs_config (src/skynet_api/config/cfg.py). This document defines where each kind of value lives and how new services should follow the same layout.

Where values live

Kind Store Path pattern Example
Cross-env shared secret Secrets Manager /common/<purpose> /common/twilio-ses
Cross-service connection (per env) Secrets Manager /<env>/shared/<purpose> /stg/shared/redis, /stg/shared/rabbitmq
Service-specific secret (per env) Secrets Manager /<env>/<service>/<name> /stg/skynet-app-api/secret-key
Non-secret config SSM Parameter Store /<env>/<service>/<name> or /common/<...> /stg/skynet-app-api/redis-db, /common/s3/creatives

Rule of thumb: if losing the value would let an attacker authenticate, it is a secret (Secrets Manager). Hostnames, ports, bucket names, regions, db indices, queue names, and URLs are configuration (Parameter Store, which is free-tier and cheaper).

Redis consolidation (AISD-14)

Previously every logical Redis DB was a full secret (/<env>/redis/db0, /db1, /db6) that duplicated the same host/port/password and differed only by the db index. Now:

  • One shared connection secret per environment: /<env>/shared/redis (single-node host/port/password for stg; startup_nodes/password for the prd cluster). No db field.
  • The db index is non-secret config: /<env>/<service>/redis-db.
  • REDIS_SETTINGS = {**get_secret("/<env>/shared/redis"), "db": int(get_parameter("/<env>/<service>/redis-db"))}.

Environment specifics:

  • Staging uses db 1 as master for all services (aligned with prod and tasks-scheduler).
  • Prod app-api runs in cluster mode, which only supports db 0 -- it stays on db 0 even though stage moved to db 1.

RabbitMQ follows the same idea, symmetric across environments: /<env>/shared/rabbitmq. Staging collapses the three per-service secrets; prod seeds /prd/shared/rabbitmq from the legacy /prd/rabbitmq/dealer (same value). The legacy /prd/rabbitmq/dealer is deleted only once harvester and tasks-scheduler also repoint to /prd/shared/rabbitmq.

Rollout & deprecation (safe, zero-downtime)

  1. Create the new shared secrets + parameters alongside the old ones (scripts/provision_aisd14_config.py --env <stg|prd>; idempotent, no overwrites).
  2. Deploy this repointed config; verify in stage, then prod.
  3. Only after prod is verified stable, delete the old/duplicate keys.

The authoritative list of keys awaiting deletion -- with per-key stage/prod verification flags -- lives in the workspace registry hq/deprecations/aws-secrets-to-delete.{yaml,md}. Do not delete any key until its safe_to_delete flag is set there.