Skip to content
Tech Interview Prep
Technical interview guide

Secrets Management in the Cloud

Using cloud-native secrets services so credentials are never hardcoded, with automatic rotation.

Minutes to read
4
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed

Scope: AWS Secrets Manager, Azure Key Vault, Google Cloud Secret Manager, and OWASP guidance current 2026-09-01.

Overview

Curated: · Written: · Reviewed:

Secrets Management in the Cloud

In one line

Cloud secret stores hold the credentials a workload still needs. The strongest design removes the credential first, using workload identity or short-lived tokens, and only then stores, delivers and rotates what remains. Reach for it whenever a static password, key or token would otherwise sit in code, images, CI settings or environment variables.

Key definitions

  • Workload identity: the platform vouches for a workload (a federated Kubernetes service account, instance or task role, or the GKE and Azure equivalents), so no stored credential is needed.
  • Static vs dynamic secret: a long-lived value changed only by rotation, vs a short-lived credential minted per consumer with a TTL.
  • Envelope encryption: a data key encrypts the secret, and a KMS key encrypts the data key. Each decrypt is a KMS call.
  • Dual credentials: two valid credentials at once, so consumers can move from old to new without an outage.
  • Authority of revocation: the system that honors the credential (database, SaaS API). Deleting the vault entry does not revoke the password.
  • Blast radius: what a leaked value can do, for how long, and what revoking it breaks.

Formulas and complexity

With process ages uniform from 0 to P, and the old credential disabled G days after each rotation, the share of running processes holding a dead credential at the instant the grace window closes is:

f=P−GPf = \frac{P-G}{P}

Hypothetical example: P = 6 days, G = 2 days, so f = 4/6, about 67% of the fleet. Processes that started before the rotation hold the old credential.

How it works

  1. The workload proves its identity to the cloud or store through its platform identity, and receives a bounded token.
  2. The store checks that identity against a policy scoped to that workload's own secrets.
  3. The consumer reads the value at start or per use, and re-reads on a schedule that matches the rotation interval.
  4. Rotation sets the new credential at the target, verifies a real login with it, then revokes the old one at the authority.
Workload identity Store checks scoped policy Short-lived read Process uses value Rotation job New credential set at target Consumers adopt and verify login Revoke old at target

When to use and when not to

OptionUse whenTrade-off to state
Platform identity, no secret (IAM database auth, OIDC federation)Workload runs on the cloud identity planeIdentity-plane outage blocks new authentication
Dynamic broker credentials (Vault leases)Many consumers, need per-consumer revocationYou run, unseal and DR-test the broker
Managed store read at startFew secrets, rare rotationA cached value keeps working until the process restarts or re-reads
Environment variableAlmost never for production secretsReadable via /proc/pid/environ, inherited by children, captured in dumps
Private endpoint aloneReducing network exposureAny identity inside the network still reaches the secret

Traps interviewers probe

  • Injected at start, rotated later. Values from env vars do not change in a running process. Fix: mount the secret as a file or re-fetch per connection, and roll pods when a value must change.
  • Revoking in the vault. Writing a new vault version leaves the old password valid at the database. Fix: change the credential at the target, verify a new login, then revoke at the database.
  • Trusting network position. A private endpoint serves every identity inside the VPC, so an over-broad instance role is the real exposure. Fix: scope each identity to its own secrets.
  • Group grants. A group granted project-wide read reaches every secret, whatever per-service grants exist. Fix: grant per secret and audit group membership.
  • Secrets in images and arguments. Values baked into image layers survive a config override, and command-line arguments appear in process listings. Fix: inspect built images, and keep values out of argv.

Interview tips

Opening: "I'd try to remove the secret first: workload identity for the service, so nothing is stored. Whatever remains goes into one store with per-service read policy, is delivered as a file or fetched at use, and is rotated with overlap."

Follow-ups to expect:

  • How does the workload authenticate without a bootstrap secret? Workload identity, and name the bootstrap problem honestly if it remains.
  • What happens when the store is down? Decide per credential: serve stale with an alert, or fail.
  • How do untrusted pull requests stay away from production credentials? Federation conditions on repository, branch and environment (the OIDC subject claim differs for pull_request runs), plus approval gates.
  • What does audit cover? Data-plane reads and decrypts, not only policy changes.

First hour of a public leak: revoke at the authority, not the vault. Find every copy and access path, mint replacement material, confirm the old value is rejected, and audit reads during the exposure window.

30-second outline: Eliminate the credential with workload identity. Keep what remains in one store with per-service policy, delivered as a file. Rotate by setting the new value at the target, verifying a login, letting consumers adopt, then revoking the old value at the authority. Alert on bulk reads and deletions. Name the cost: short-lived identity depends on the identity plane being available.

Feedback on this overview

Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.