SecurityIntermediate

Secrets at Scale: Rotation, Audit, and Break-Glass Access

DeveloperHat Team
23 min read

TL;DR

Rotation that doesn't cause outages, audit trails that survive an incident, and break-glass access that works when it matters — the operating model for secrets at scale.

Most teams do not have a secrets problem at ten services. They have one at a hundred, when the database password lives in five places, the third-party API key was pasted into a chat thread in 2023, and nobody can say — with evidence — who read the production Stripe key last month. The secret itself was never the hard part. Storing a value securely is a solved problem. The hard part is operating it: knowing every secret exists, changing each one without breaking the thing that uses it, proving afterward who touched it, and still being able to get in when the system that guards the secrets is itself down.

The short version: put every secret in one store, give every secret a lifecycle with an owner and an expiry, rotate machine credentials on a schedule and human passwords only on evidence of compromise, log every access somewhere the store cannot rewrite, and keep a sealed, tested break-glass path for the day the store is unavailable. That is the whole operating model, and the rest of this guide is the machinery that makes each piece hold up: which store fits which shape of team, how rotation avoids the outage it is supposed to prevent, and what an audit trail has to contain to be useful in an incident instead of decorative.

The secret lifecycle: five states, and audit watches all of them A secret that never rotates is not stable. It is a credential whose leak you have not found yet. 1 · Issue minted, scoped 2 · Distribute least privilege 3 · Use read at runtime 4 · Rotate on schedule 5 · Revoke on demand Audit — every read, rotation and revocation is logged tamper-evident, shipped off the store If a stage has no owner and no log line, it is not a process — it is a hope.

Why secrets break at scale

A single application with one database password can be managed by hand. Scale breaks that in four specific ways, and naming them matters because each one points at a different fix.

Sprawl. Every new service, environment, and integration adds credentials, and each one is created by a different person, in a different place, for a different reason. The result is not a list but a rumor: the team believes the production secrets live in the vault, while the staging database password sits in a shared doc and the CI pipeline has a service-account key that predates two reorgs. Sprawl is why the first step of any secrets programme is an inventory, not a purchase.

Static values. A credential that never changes has an unlimited blast radius for its entire life. If it leaked six months ago — into a log, a screenshot, a compromised laptop — it still works today, and there is no event that would tell you. Rotation exists to put a bound on that window. The point is not that rotating every 30 days makes a leaked credential harmless; it is that a leaked credential stops working on its own, without anyone having to find the leak first.

Shared knowledge. A secret that five people know is not a secret; it is a shared password with five copies outside any system. Every person who knows it is a person whose laptop, phone, or departure can expose it. At scale the fix is to stop distributing the value at all: the application reads the secret from the store at runtime, the human never sees it, and the store's access log is the complete list of who used it.

No revocation story. The question that separates a mature setup from a folder of credentials is not "where are the secrets?" but "how fast can you kill one?" If the answer involves finding every copy, redeploying every consumer, and hoping nobody cached it, the answer is "not fast enough." Revocation has to be one operation in the store, and every consumer has to be built to pick up the new value without a deploy.

Inventory first: you cannot rotate what you cannot see

Before choosing a store, count what you have. The inventory is the unglamorous step that decides whether everything after it works, because a rotation schedule that covers 80% of your secrets is a schedule that leaves the other 20% as permanent, unmonitored access.

Start with the easy sources: the secret store itself, the cloud provider's secret services, and the CI system's credential store. Then go looking for the places secrets hide: environment files committed to repositories, deployment scripts, Terraform state, Kubernetes manifests, chat history, and the laptops of the two engineers who set up the first services. AI coding tools have made this worse in a specific way — pasting a real credential into a prompt sends it to a third party, which is why our secrets hygiene guide for AI coding tools treats "never paste a live secret into a model" as a rule, not a preference. Scan repositories for high-entropy strings and known key formats; the scanners will produce false positives, and that is fine — a false positive costs a minute, a missed production key costs an incident.

For each secret, record four things: what system it grants access to, which workloads actually use it, who owns it, and when it last changed. Anything without an owner is unowned, and unowned secrets are the ones that never rotate, because nobody's job depends on it. Anything whose consumers are unknown cannot be rotated safely, because you cannot tell whether the old value is still in use. The inventory's real output is not the spreadsheet; it is the list of secrets you cannot account for, which is the work list for the next month.

One structural decision belongs here, before any tooling: a secret should be created by the system that owns the thing it protects, not by a human typing a password into a console. Database credentials come from the database's own rotation or from a dynamic secrets engine; API keys are generated by the vendor's console with a name that says which service uses them; certificates come from a CA, not from an openssl command on someone's laptop. Human-generated secrets are the ones that end up in chat threads.

The three stores, head to head

For most teams the choice is between three managed options, and they differ less in security than in who does the work. All three encrypt at rest, all three control access with the cloud's identity system, and all three keep versions. What differs is rotation, dynamism, and where the operational burden lands.

AWS Secrets ManagerHashiCorp VaultGoogle Cloud Secret Manager
RotationManaged for RDS, Aurora, DocumentDB, Redshift; Lambda templates for the restNo built-in rotation for static secrets; dynamic secrets insteadNotification-based: you write the rotator
Dynamic secretsNo — values are stored, then rotatedYes — credentials minted on demand with a TTLNo — values are stored, then rotated
Multi-cloudPossible, awkwardNative — Vault is the abstractionPossible, awkward
AuditCloudTrail integrationBuilt-in audit devicesCloud Audit Logs
You operateAlmost nothingThe cluster, the unseal, the upgradesAlmost nothing

AWS Secrets Manager is the right default on AWS. Its managed rotation covers the databases most teams actually run — RDS, Aurora, DocumentDB, and Redshift — and for anything else you write a Lambda function from a provided template. You can rotate a managed secret as often as every four hours, and the schedule is a rate() or cron() expression in UTC, with a window you control. The design detail that matters is the rotation strategy: single-user rotation briefly changes the only credential, which means a short window where the old password no longer works; alternating-users rotation keeps two users and flips between them, so there is no window at all. If your application reads the secret at runtime — or through the caching client — alternating-users rotation is genuinely zero-downtime. If it reads the secret once at startup, no rotation strategy saves you; fix the read pattern first.

HashiCorp Vault is the right default when you are multi-cloud, or when you want dynamic secrets rather than rotated static ones. Vault does not rotate a stored password for you. Instead, its secrets engines mint a fresh credential each time one is requested — a database user created for this one application, an AWS access key for this one CI job — and attach a lease with a time-to-live. When the lease expires, Vault deletes the credential. That is a different model from rotation, and for short-lived workloads it is a better one: there is no old value to hunt down, because the value only ever existed for one consumer.

Google Cloud Secret Manager is the right default on GCP, with one honest caveat: its rotation is notification-based, not automatic. You configure a rotation period — at least one hour — and a Pub/Sub topic; when a secret is due, Secret Manager publishes a notification, and your Cloud Function or Cloud Run service does the actual work of creating the new credential in the target system and adding it as a new version. Google schedules the rotation; you perform it. That is a real engineering cost, and teams that choose GCP should budget for the rotator as a service they own, not a feature they enabled.

The honest comparison is that the store matters less than the discipline around it. A team on AWS Secrets Manager with an inventory, alternating-users rotation, and an audit trail that someone reads is in a better position than a team on Vault whose cluster nobody patches and whose leases never expire. Pick the store that matches where your workloads already run, and spend the saved effort on the operating model.

Secrets at scale: one store, one encryption layer, one audit trail Workloads — apps, CI jobs, operators read at runtime only Secret store — Vault, AWS Secrets Manager or GCP Secret Manager Envelope encryption — KMS/HSM holds the key, never the application Audit log — every access shipped to storage the store cannot rewrite Break-glass — sealed, time-boxed, alarmed, tested on a schedule The store is the only place a secret exists at rest. Everything else is a lease on it.

Rotation that does not take anything down

Rotation fails in production for a small number of repeatable reasons, and each one is preventable if you design for it before the first rotation runs.

The application caches the secret forever. The most common rotation outage is not a rotation bug; it is an application that reads the secret once at startup and holds it in memory for the life of the process. Rotate the credential and the application keeps using the old value until it restarts — and if it restarts after the old value is disabled, it fails to start at all. The fix is a read pattern, not a schedule: fetch the secret at runtime, cache it briefly, and refresh it on authentication failure. AWS's caching client for Secrets Manager does exactly this, including a refresh on failure. If a legacy service cannot be changed to read at runtime, give it a long overlap: keep the old value valid for a grace period after the new one is issued, and rotate during a window when a restart is safe.

The rotation function cannot reach the target. A Lambda rotation function that lives in a VPC without a route to the database, or without the security-group rule, fails silently on a schedule nobody watches — and the secret keeps its old value for months while the console says rotation is enabled. Test rotation on a non-production secret first, and alert on rotation failure the same way you would alert on a backup failure: it is a control that has stopped working, and the only thing worse than no rotation is rotation you believe is running.

Two consumers, one credential. If the same database password is shared by the application and the reporting job, rotating it breaks whichever consumer reads second. The fix is one credential per consumer, which is also the reason to prefer alternating-users rotation: each user has its own credential, so the application and the reporting job can rotate on different schedules without coordinating. Shared credentials are the secret-management equivalent of a shared login, and they fail for the same reason — you cannot revoke one consumer's access without revoking everyone's.

The schedule is a superstition. Thirty, sixty, or ninety days are all common, and none of them is a law of nature. The schedule should follow the blast radius: a production database credential that is read by twelve services deserves a shorter interval than a read-only API key for an internal dashboard. AWS lets you set AutomaticallyAfterDays anywhere from 1 to 365, and managed rotation can run as often as every four hours — the range exists because the right interval depends on the secret, not on the calendar. What matters more than the number is that the schedule is enforced by the store, not remembered by a person, and that a missed rotation pages someone.

Human passwords are a different subject. This is the one place where the conventional wisdom has reversed, and getting it backwards is a real mistake. NIST SP 800-63B-4, published in July 2025, says verifiers shall not require periodic password changes for human memorised secrets, and shall force a change only when there is evidence of compromise — a breach, a phishing report, suspicious activity. The evidence behind that is straightforward: forced rotation drives people to predictable variations of the same password, which is weaker, not stronger. That guidance is about human passwords. It does not apply to machine credentials, which are not memorised, not typed, and not phished the same way — and which are often distributed widely enough that scheduled rotation is the only bound on how long a leaked value stays useful. The rule is: rotate the secret a machine holds on a schedule; change the password a human holds when there is a reason.

Dynamic secrets: the credential that never lives long enough to leak

Rotation bounds the life of a static credential. Dynamic secrets remove the static credential entirely, and for some workloads that is the better answer.

In Vault, every dynamic secret comes with a lease: metadata carrying a time-to-live, a renewability flag, and an ID. When an application reads a database credential from Vault's database secrets engine, Vault creates a real database user, hands over the username and password, and records the lease. The application can renew the lease — vault lease renew extends the TTL, up to a maximum — and when the lease expires, or is revoked, Vault deletes the database user. Revocation is one command, and it works by prefix too: vault lease revoke -prefix database/creds/readonly kills every credential issued under that role at once, which is the break-glass operation for a compromised service in a single line.

# Renew a lease before it expires (up to the role's max TTL)
vault lease renew database/creds/readonly/$LEASE_ID

# Revoke one credential immediately
vault lease revoke database/creds/readonly/$LEASE_ID

# Break-glass: revoke every credential under a role at once
vault lease revoke -prefix database/creds/readonly

Three properties of the lease model deserve attention, because they are the ones that surprise teams migrating from static secrets. First, the system maximum TTL is 32 days by default: a credential renewed faithfully every hour still dies at the ceiling, so long-lived services must be built to re-authenticate, not just to renew. Second, when a token expires or is revoked, every lease created under it is revoked too — the database password your application is mid-query with can vanish because the token that created it expired. Third, the answer to both is to stop writing renewal logic in application code and use Vault Agent, which authenticates, caches the token, and renews tokens and leases automatically, writing fresh secrets to a file or template the application reads.

Dynamic secrets fit best where the credential's consumer is short-lived: CI jobs, batch workers, ephemeral environments, and any service that starts often enough that fetching a fresh credential is cheap. They fit worst where the consumer is a long-lived process that assumes its credentials never change, or where the team cannot operate Vault itself — a dynamic-secrets engine that is down is a deployment blocker for every service that depends on it, which is a different kind of single point of failure from a static secret in a file. Vault's own lease documentation is the reference for the TTL hierarchy: system maximum, mount maximum, role maximum, and the requested TTL, with the shortest winning.

Audit: the log that has to survive the incident

An audit trail is only useful if it answers, after the fact, who read which secret, when, and from where — and if the answer is trustworthy when the reader is the attacker. That sets three requirements.

Log every access, not just every change. Rotation events and revocations are the minority of the story. The question in an incident is almost always about reads: which credentials did this compromised service account touch, and when did it first touch them? That means the store must log reads with the identity, the secret name, the source, and the result, and it must do so by default, not as an optional feature someone enables later. Vault's audit devices, CloudTrail for Secrets Manager, and Cloud Audit Logs for GCP all do this; the failure mode is a team that never checks whether the logging is actually on.

Ship the log somewhere the store cannot rewrite. An audit trail stored in the same system it audits is a trail the attacker can edit by compromising that system. The logs should flow to separate storage — a different account, an immutable bucket, a SIEM — with retention that outlasts the incident review cycle. The test is simple: if the secret store were fully compromised tomorrow, would the access history still be intact? If the answer is no, the audit trail is a compliance checkbox, not a control.

Alert on the anomalies, not on the volume. A log nobody reads is a log that exists for the auditor, not for the team. The signals worth alerting on are narrow: a secret read from a new network or identity, a sudden increase in read volume from one consumer, a read of a high-value secret outside its normal hours, a rotation failure, and any break-glass access at all. The rest is for forensic search. Teams that alert on every read drown in noise and stop reading; teams that alert on nothing discover the breach from a customer.

There is a related discipline worth naming: secrets and zero trust are the same conversation. A secret is only as safe as the identity that can read it, which is why our zero-trust architecture guide treats "verify explicitly, grant least privilege, assume breach" as the frame, and secrets management as one of the controls inside it. The store enforces who can read; the audit trail proves whether the enforcement held.

Break-glass: the access you hope you never use

Every secrets system needs a way in when the system itself is down, the identity provider is down, or the person on call cannot authenticate through the normal path. That path is break-glass access, and it is the control most often designed badly, in both directions: either it does not exist, so an outage becomes a lockout, or it exists with no controls, so it becomes a permanent backdoor.

A break-glass credential should be sealed, not merely stored: written down or held in a separate system, split across two people or two locations, and never used for routine work. It should be time-boxed — usable for the incident, then rotated immediately afterward, because the moment it is used its secrecy is spent. It should be alarmed: any use of it pages the security team, and the alarm cannot be silenced by the person using the credential. And it should be tested on a schedule, because a sealed envelope nobody has opened in two years is a credential whose password may have been changed, whose account may have been disabled, or whose envelope may contain a password for a system that no longer exists.

The test is the part teams skip, and it is the part that matters. A quarterly break-glass drill — open the envelope in a controlled way, authenticate, verify the access works, rotate the credential, reseal it — takes an hour and is the difference between a plan and a hope. If the drill fails, that is a finding, not an embarrassment; finding it in a drill is the entire point.

Kubernetes teams should apply the same thinking to the cluster's own secrets. Secrets stored in etcd are encrypted at rest only if you configure an EncryptionConfiguration — by default they are base64, which is encoding, not encryption. The safer pattern is to keep secrets out of the cluster's native store entirely and sync them from the central store with the External Secrets Operator or the Secrets Store CSI driver, so the cluster holds a lease on a secret, not the secret itself. That also keeps the rotation story in one place: rotate in the store, and the cluster picks it up, instead of maintaining a second rotation schedule inside Kubernetes.

Recommendation: the operating model

For a team that is starting from a folder of credentials, or from a store that nobody operates, the order of work is:

  • Inventory — every secret, its owner, its consumers, its last rotation. Fix the unowned and unknown first.
  • One store — the managed store that matches where the workloads run; one place a secret exists at rest.
  • Runtime reads — applications fetch secrets at runtime and refresh on authentication failure, so rotation cannot break them.
  • Rotation by type — managed rotation with alternating users for databases; custom rotation functions for the rest; compromise-driven changes only for human passwords.
  • Dynamic where it fits — short-lived workloads get leased credentials that expire on their own.
  • Audit shipped elsewhere — every read logged, logs in separate storage, alerts on anomalies.
  • Break-glass sealed and tested — quarterly drill, immediate rotation after use.
  • Pick the rotation model by what the secret actually is What kind of secret? human · machine · ephemeral Human password a person types it Managed DB credential RDS · Aurora · Redshift Other machine secret API key · token Compromise-driven NIST 800-63B-4 Managed rotation alternating users Custom or dynamic Lambda · Vault lease Short-lived CI credentials skip rotation entirely — they expire before they can leak.

    Architecture Decision

    Decision: Run secrets from a single managed store (AWS Secrets Manager, Vault, or GCP Secret Manager, chosen by where the workloads already run), with runtime reads, rotation by secret type — managed alternating-users rotation for database credentials, custom rotation functions for other machine secrets, compromise-driven changes only for human passwords — dynamic leased credentials for short-lived workloads, audit logs shipped to separate storage, and a sealed, quarterly-tested break-glass path.

    Context: The team runs dozens of services across environments, credentials are created by different people in different places, and the last incident review could not answer who had read a production credential or when it had last changed. There is no maintenance window for credential changes, and the on-call rotation includes people who have never touched the secrets infrastructure.

    Options considered: (1) The single-store model above. (2) Keep secrets in the existing mix of environment files, CI stores, and cloud services, and add a scanner — cheapest to start, but it leaves every secret in a different lifecycle and makes rotation a manual project per secret. (3) Vault everywhere, including single-cloud teams — the dynamic-secrets model is the strongest, but operating Vault is a real commitment, and a team that cannot patch it reliably is worse off than a team on a managed store. (4) A secrets-as-code approach with encrypted files in Git — auditable and reviewable, but it distributes the ciphertext to every clone, makes rotation a commit, and fails the moment a key needs to change without a deploy. (5) Build a custom rotation service — maximum control, and a permanent second system to operate, secure, and audit.

    Why this one: The single store removes the inventory problem at the root — there is one place a secret exists, so there is one place to audit and one place to revoke. Rotation by type respects the one real disagreement in the field: machine credentials benefit from scheduled rotation because they are widely distributed and never memorised, while human passwords are harmed by it. Dynamic secrets close the gap for the workloads where even scheduled rotation is too slow. And the break-glass path is the admission that any system can fail, including this one.

    What it costs you: One more system to operate, or one more managed bill, depending on the choice. Runtime reads mean touching every service's startup code once. Rotation schedules need an owner and an alert, or they silently stop. Vault, if chosen, needs patching, unseal procedures, and a backup story of its own. And the inventory is a real project — the first count will find secrets nobody can explain, and each one needs a decision.

    When to reverse it: On a single service with one database and one engineer, the whole model is overhead — a managed store with rotation enabled is enough, and the ceremony can wait until the second service. Reverse toward Vault's dynamic model entirely when the workload is mostly short-lived compute and static credentials become the exception rather than the rule. And reverse the single-store choice if the cloud strategy changes: a team that moves from AWS to multi-cloud should move its secrets to the store that follows the workloads, not the one that matched the old estate.

    When NOT to run this operating model

    The model is not free, and there are situations where the honest answer is simpler. Do not build a Vault cluster for a team of three running one application — the operational cost exceeds the risk, and a managed store with rotation enabled covers the actual threat. Do not rotate a credential whose consumers you have not inventoried; rotation without a consumer list is how a routine Tuesday becomes an outage. Do not enable rotation and walk away — an unmonitored rotation schedule is a control that fails silently, and the failure is discovered at the worst possible moment. Do not put break-glass credentials in the same store they are meant to rescue you from; the envelope has to survive the store being down. And do not treat the audit trail as a compliance artifact: if nobody has ever searched it, run the exercise — pick a production secret, reconstruct its last month of reads, and see whether the log can actually answer the question. If it cannot, the model is not running yet, whatever the console says.

    The test for whether the operating model is worth it is one question: if a production credential leaked today, how long would it stay useful, and how would you know? If the answer is "until someone finds it, and we would not know," the model pays for itself the first time a rotation kills a leaked credential before anyone has to find the leak. If the answer is already "thirty days, and the audit log would show the first anomalous read," then the model is already running — keep it running, and spend the effort on the next risk. The goal was never to make secrets clever. It is to make them boring: a credential changes on a schedule, the old value stops working, the log records who used it, and nobody in the incident channel has to think about any of it. One store, one lifecycle, one log — and a sealed envelope for the day the store itself is the problem. That is the whole discipline, and it is enough.

    Why This Matters

    Understanding the business and technical context helps you make informed decisions rather than blindly following patterns.

    Trade-offs to Consider

    Every architectural decision involves trade-offs. Consider your specific requirements, team expertise, and scale when evaluating options.

    When NOT to Use This

    Knowing when a solution doesn't apply is as valuable as knowing when it does. Consider alternatives for your specific situation.

    Decision Framework

    Use this framework to evaluate whether this approach is right for your use case based on your specific constraints and requirements.

    Share this articleShare on XShare on LinkedIn

    Keep the decision frameworks coming

    One practical architecture guide a week — patterns, trade-offs, and when not to use them. No spam, unsubscribe anytime.