Secret and certificate lifecycle
Secrets are not the same as keys or certificates
A secret is a sensitive value consumed by an application, such as a database password or API credential. A cryptographic key is material used by a cryptographic operation; a managed key may never be exportable as plaintext. A certificate is a signed statement binding a public key to an identity, with a validity interval and issuer. The certificate itself is usually public; its associated private key is sensitive. A secret manager stores and serves sensitive values to authorized callers. A certificate manager handles issuance, renewal and deployment integrations. Neither service eliminates the need to control access to the application using the value.
A workload should obtain a managed or federated identity where supported rather than using a static credential to retrieve another credential. Grant access to the narrowest secret or key scope supported. Avoid embedding secrets in source code, images, build logs, command lines or configuration committed to Git. Restrict debugging output and ensure application errors never expose the value. Do not print real secrets even to demonstrate a successful retrieval.
Rotate a credential without breaking consumers
Rotation replaces a credential at its issuing system and updates the applications that use it. Merely writing a new version into a secret store does not update the database password. If a target supports two active credentials, a controlled overlap can prevent interruption. A typical fictional bookstore procedure is: create a replacement credential under approved policy, verify access in a canary consumer, update remaining consumers, observe errors and successful authentication, and review retirement of the previous credential after the rollback window. If the target supports only one active credential, use a service-specific coordinated cutover and downtime or recovery plan instead.
Suppose version B is available at minute 0 and consumers refresh at minutes 4, 7 and 11. If the old credential is retired at minute 8, the last consumer may fail for three minutes. With a hypothetical five-minute observation period after the last refresh, the earliest review point is minute 16, assuming all checks are healthy. This is not a universal rotation interval. A compromised credential may need urgent revocation without normal overlap under an incident-response plan. Do not keep known compromised credentials active merely to satisfy a normal rotation schedule.
AWS Secrets Manager supports rotation strategies for supported targets, including alternating users. Azure Key Vault provides versioned secrets and rotation integrations or custom workflows depending on the asset. Google Cloud Secret Manager rotation schedules can publish a rotation notification; a consumer workflow must implement the actual replacement. A notification is not evidence that a credential was changed successfully.
Certificate issuance, deployment and renewal
A TLS certificate binds a public key to a name through a certificate authority (CA). A client checks the trust chain, hostname, validity interval and applicable certificate constraints. The private key must stay protected; a valid certificate is not proof that a user is authorized to access the API. TLS termination at a load balancer does not guarantee TLS to the backend. Verify both connections according to the architecture.
For a fictional service at api.example.com, record the certificate owner, endpoint, issuer, expiration, validation method, deployment status and renewal alert. A replacement certificate must cover the correct name and chain, be deployed to the intended listener and be observed by a client before the old one expires. Renewal and private-key replacement are distinct decisions. Do not disable hostname or trust verification to resolve an error.
AWS Certificate Manager can renew eligible Amazon-issued certificates, but imported certificates require a separate renewal process. Azure Key Vault certificate renewal depends on issuer and configured policy; confirm that consuming applications reload the renewed version. Google Cloud Certificate Manager automatically renews eligible Google-managed certificates; independently monitor provisioning, domain authorization and served certificate state. These integrations are not interchangeable. Avoid assuming every managed certificate is eligible for every endpoint or that expiry alarms guarantee renewal.
Practice with a limited rotation decision model
This standalone Python example evaluates review conditions using only booleans. It uses no secrets, cryptography, network or provider APIs. It is not an authorization system, certificate validator or automated retirement mechanism. The output is a recommendation for a fictional operator, never an instruction to delete keys or revoke access automatically.
def rotation_gate(new_valid, consumers_ready, health_ok, rollback_ready, old_required): if not new_valid or not health_ok: return "hold-and-investigate" if not consumers_ready or not rollback_ready: return "keep-overlap" if old_required: return "retain-old" return "review-retirement"
print(rotation_gate(True, False, True, True, False))print(rotation_gate(True, True, True, True, True))print(rotation_gate(True, True, True, True, False))Expected output:
keep-overlapretain-oldreview-retirementThe first case still has consumers on the old version. The second case has an explicit old-version dependency, so retirement is premature even though consumers are healthy. The third case permits a human review, not deletion. A failed validation or health check takes priority over overlap and retention. A rollback plan must be usable, not just written down. The model deliberately cannot detect hidden dependencies; production review must examine independent evidence.
Failure diagnosis and operational cost
If a release suddenly fails after rotation, distinguish a retrieval denial from an invalid credential at the target, an outdated cache, an unavailable key operation and an expired certificate. Inspect redacted status codes, audit records, version identifiers and timestamps before changing policies. Do not broaden permissions or suppress TLS verification as a quick fix. Check actual dependency inventories and restore tests; do not rely on the absence of errors in one application.
Secret stores may charge for stored versions and API calls, and HSM or certificate services may introduce separate fees. Estimate request rates from refresh behavior and rollout size. Avoid unlimited retries or forcing all replicas to refresh simultaneously. Bound backoff, monitor failures and use supported caching while balancing freshness and exposure. Real pricing must be checked for the selected service, plan and region.
Practice and next steps
Draw a rotation timeline with a replacement version, three consumers and an observation period. Identify which failures would stop the change, how rollback is verified, and what evidence an operator needs before reviewing retirement. Add a separate certificate renewal check for the same application. Use the manual exercise and quiz to test the distinction between rotation, renewal, revocation and deletion. Next: cloud security architecture and shared responsibility.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Secret and certificate lifecycle — knowledge check
Choose the best answer for each offline scenario.
What must happen when a database password is rotated?
Consumers refresh at minutes 4, 7 and 11. With a five-minute observation period, when is the earliest review?
What does a Google Cloud Secret Manager rotation notification establish?
Which certificate needs a separately arranged renewal in ACM?
What is the model outcome if consumers are ready and healthy but an old backup depends on the prior version?