Encrypting data and protecting application credentials are related but different security problems. Amazon Web Services provides AWS Key Management Service (KMS) to manage cryptographic key use and AWS Secrets Manager to store and rotate application secrets. Both services are powerful only when access policies, application code, operational monitoring, and recovery processes are designed together. Choosing KMS does not automatically stop data disclosure, and placing a password in Secrets Manager does not guarantee that the password can never leak.
The distinction helps architects make practical decisions. A storage service can encrypt a large object using a data key protected by KMS, while an application can fetch its database credentials from Secrets Manager rather than embed them in a deployment package. The authorization paths are different, however, and a compromised role with broad permission to decrypt or retrieve secrets can still expose protected resources. The goal is to identify the exact principal, resource, and operation required for each workload.
How AWS KMS keys and envelope encryption work
In KMS, a KMS key is a managed cryptographic resource associated with material used by the service for encryption, decryption, signing, or related operations, depending on key type. An application rarely needs to send a large file directly to KMS. Instead, envelope encryption commonly protects the file with a symmetric data key and encrypts that data key with a KMS key. The encrypted data key can be stored alongside the encrypted object without exposing its plaintext form, provided the application controls data-key handling properly.
A typical application calls GenerateDataKey or an equivalent service integration, uses the plaintext data key only for the necessary cryptographic operation, and then discards that plaintext from memory as reliably as its runtime allows. The encrypted data key is retained for later recovery. The security boundary is therefore not just the KMS key policy: it also includes where plaintext data and data keys exist in the application. The design should avoid logging plaintext keys or holding them longer than necessary.
KMS keys have operational lifecycles and policies. Changing an alias does not change the cryptographic material protecting previously encrypted data. Deleting a KMS key after its applicable waiting period can make ciphertext encrypted exclusively under that key unrecoverable. Therefore, key deletion is a controlled change, not an ordinary cost cleanup. A documented cryptographic key lifecycle should account for backups, disaster-recovery restoration, grants, and dependent services before a key is disabled or scheduled for deletion. For a more specialized discussion, AWS KMS encryption contexts show how additional authenticated metadata can bind certain cryptographic operations to an expected application context.
Key policy, IAM, and grants form one authorization decision
Every KMS key has a key policy. A role’s IAM permission to call Decrypt is not always sufficient: the relevant key policy must also allow the request, either directly or by allowing IAM delegation. KMS grants can authorize specific use by integrated AWS services, and organization policies or endpoint policies can further restrict access. Evaluation must therefore consider the combined effective permissions, not just whether a single IAM statement includes a wildcard action.
Separate key administration from routine use. An application role may need to encrypt and decrypt with one key, but it normally does not need to modify key policy, schedule deletion, or create arbitrary grants. Conversely, a key administrator may need governance actions without being able to read every protected workload’s data. Where feasible, use conditions such as encryption context, caller account, and service context to constrain operations; verify those conditions against actual AWS service behavior before applying them broadly.
Grant and key-policy changes can have different propagation and operational effects. Do not assume that revoking an IAM permission instantly invalidates credentials already held by running code or terminates every downstream service session. Incident-response plans should explain how to identify affected roles, revoke access, rotate exposed application secrets, and verify that a formerly authorized operation is now denied. Maintain a tightly scoped break-glass procedure rather than relying on a single all-powerful administrator role.
What Secrets Manager stores and how applications retrieve it
A secret in Secrets Manager is an encrypted value and associated metadata, often representing a password, API token, or connection string. Applications retrieve it through authenticated API calls and can cache it for performance, subject to a bounded refresh policy. This is preferable to hard-coding credentials in source control, but it does not mean a secret can never appear in memory, environment variables, debug logs, or crash reports. Developers must handle the retrieved plaintext securely after the service returns it.
Use a workload identity rather than a long-lived access key to authorize retrieval where possible. An application that requires only one secret should not receive blanket permission to read every secret in the account. Resource policies can allow controlled cross-account access, but encrypted secrets may also require permission to use their KMS key. When using a customer managed key for a cross-account secret, both the Secrets Manager resource policy and the applicable KMS and IAM permissions must agree. A failed retrieval can be caused by any one of these boundaries.
For regulated data, classify whether the value is a secret at all. A public configuration parameter should not be treated as sensitive merely because an application consumes it, and not all sensitive records belong in Secrets Manager. Designing an appropriate storage and secrets management approach reduces duplicated credentials and uncontrolled copies across teams.
Rotation requires a working dependency, not just a schedule
Secrets Manager can automate credential rotation using managed rotation for certain service-managed credentials and Lambda-based rotation for other integrations. A Lambda workflow normally creates a candidate version, updates the target system, tests the new credential, and promotes the version to current. The design must be idempotent because retries and partial failures occur. A valid rotation schedule is therefore only the beginning: the target database or API must accept the new credential, and applications must refresh cached values safely.
Rotation does not guarantee zero downtime. A single-user credential change can temporarily break new connections while an application still uses its former value. Alternating-user strategies reduce that risk in supported databases but introduce other operational dependencies. Monitor rotation windows, failed attempts, permission errors, and version-stage transitions; implement retries and recovery behavior that is safe for the application. Test what happens if the target service is unavailable during the set or test phase rather than assuming automatic retries always recover.
A successful rotation also does not necessarily revoke every previously issued session or token. Database connections may persist, and a third-party API may have independent token lifetimes. During an incident, revoke credentials at the actual target system and validate access from a test identity after the change. Avoid broad conclusions such as “automated rotation prevents all credential exposure”; it reduces exposure windows and operational work when engineered and monitored appropriately.
Multi-Region KMS keys and disaster recovery
Multi-region keys share cryptographic properties such as key material and key ID across related KMS resources in multiple AWS Regions. For eligible AWS-generated key material, AWS KMS securely replicates the material between Region-specific HSM environments. It is inaccurate to claim that key material never crosses Region boundaries at all. Related KMS keys still have distinct ARNs, independent key policies, grants, aliases, and operational settings; enabling use in one Region does not automatically authorize use in another.
Use multi-Region keys only when the application genuinely needs those cryptographic properties, such as particular cross-Region backup or disaster recovery designs. They are not a universal default for data residency: organizations with requirements to confine key material to a single jurisdiction should evaluate whether replication is permitted. Test restoration with the correct destination key, policies, service integration, and encrypted data rather than assuming that a replica key alone makes a workload recoverable.
Secrets Manager secret replication and KMS key replication are distinct operations. Replicating a secret requires permissions and an appropriate encryption key in the destination Region. If an application fails over, its identity, network endpoint, secret ARN, and credential-refresh behavior must also be valid in that Region. A recovery plan that inventories only encrypted backups but omits these dependencies may fail at the moment it is most needed.
CloudTrail evidence is valuable but not unconditional
AWS CloudTrail can record KMS and Secrets Manager API activity, including identity and request metadata relevant to investigation. However, organizations can configure trails or event data stores to exclude certain classes of events, including AWS KMS events in some trail configurations. For that reason, “every key operation is always logged in our audit account” is not a safe statement until the effective selectors, delivery, retention, and destination integrity have been verified. An audit plan should check both permitted operations and deliberately denied test requests.
Some sensitive response fields are omitted from KMS log records, and log delivery does not mean that plaintext data or secret values are captured. This is a security benefit, but also a limitation: investigators often need to correlate CloudTrail records with application logs, service access logs, and identity events. Centralize necessary evidence in an appropriately protected account or store, monitor changes to logging configuration, and test alerts for unusual Decrypt or GetSecretValue patterns. Repeated access can be legitimate for cached workloads, so rate alone is not proof of compromise.
Operations should also cover the observability of rotation failures, unexpected grant creation, changes to key policies, disabled keys, secret deletions, and denied cross-account requests. The response procedure should identify which keys and workloads depend on a suspect principal. Overly broad permissions may make a legitimate application difficult to isolate during a live incident; narrower identity boundaries simplify both prevention and containment.
Cost, architecture decisions, and the skills behind them
KMS and Secrets Manager have distinct pricing dimensions: key ownership, certain API operations, secret storage, and rotation-related resources may contribute to cost. The cheapest design is not necessarily the safest. Consolidating unrelated workloads under one customer-managed KMS key can reduce key count but also couple their access and blast radius. Conversely, creating an independent key for every small resource can increase governance complexity without adding meaningful isolation. Make the choice based on data classification, required permissions, recovery boundaries, and cost evidence from the actual billing configuration.
Use infrastructure as code to version key policies, secret resources, and allowed access relationships, but protect the state and plans from storing plaintext secrets. Establish approval for material changes to key policy, grant rules, deletion schedules, and cross-Region replication. An effective architecture is one in which the right application can retrieve or decrypt exactly what it needs, operators can explain the resulting audit trail, and a failure can be recovered without bypassing security controls.
For candidates pursuing the current AWS Certified Security – Specialty exam, this topic appears in the wider data-protection and IAM design context. The SCS-C03 pathway is useful when learning to compare key policies, IAM, grants, encryption context, secret rotation, and logging rather than memorizing a single API command. These same skills apply in production: trustworthy encryption and secret storage require correct cryptographic boundaries, least-privilege access, tested rotation, and evidence that the expected controls actually operate.
The most reliable outcome is a documented and tested chain of custody for sensitive data and credentials. Define the protected data, the application identity, the cryptographic key and policies, the retrieval or decryption path, the audit trail, and the recovery plan. A team that can trace those dependencies and successfully test a failure scenario is in a stronger position than one that simply enables the default encryption checkbox and assumes the job is done.