What is AWS KMS? Who holds the keys to your data

Logeshwaran.C

AWS KMS — the full form is AWS Key Management Service — is Amazon's managed service for creating and controlling the keys used to encrypt and sign your data across AWS services and your own applications. The counterintuitive part of "who holds the keys": for a standard customer-managed key, the key material is generated and stored inside FIPS 140-3 validated hardware security modules (HSMs) that AWS physically owns — yet nobody at AWS can use that material without the permissions you grant in the key policy, and if even that is too much for you, KMS can run in a mode where the key material never leaves your own HSM at all.

⚡ Quick Answer

What AWS KMS is → a managed, regional service for creating and controlling the keys that encrypt and sign your data in AWS and your apps.

Who holds the keys → for standard customer-managed keys, AWS holds the key material in FIPS 140-3 validated HSMs, but you hold the permissions. With an external key store (XKS), the material never touches AWS.

Best default → a customer-managed symmetric key with automatic key rotation enabled, controlled by a least-privilege key policy.

If you only read this box: start with a customer-managed key, turn rotation on, and control it with a key policy. See the key policy steps, jump to the CLI encrypt/decrypt example, or check what it costs.

Imagine a bank vault for your encryption keys. You do not build the vault, you do not guard it, and you do not need to know how the lock works inside. But you decide who gets a key card, you can revoke access instantly, and you can audit every time the vault is opened. That is AWS KMS in one sentence.

When you switch on encryption for S3, RDS, EBS, DynamoDB, Lambda environment variables, or dozens of other AWS services, a KMS key is almost always the thing doing the protecting. You manage it through the AWS Management Console (search for "KMS" in the service search), the AWS CLI, the SDKs, or infrastructure-as-code tools such as CloudFormation and Terraform. The service is regional — you create keys in the Regions where you need them — and it is designed so you never have to patch an HSM, rotate a certificate, or babysit a key server.

Jake runs a small phone-repair shop and keeps three years of customer records, payment references, and repair logs in a few AWS services. He had been assuming "the cloud is encrypted" and moving on. Ethan, his mentor on all things infrastructure, sat him down last week: "The cloud encrypts a lot of things by default, but who controls the key is the part that decides whether you can actually restrict access, prove compliance, or recover after a mistake. That is the whole reason KMS exists."

What is AWS KMS?

AWS Key Management Service is, at its core, a managed key custodian. AWS's own documentation describes it as "an encryption and key management service scaled for the cloud" and as a service "that makes it easy for you to create and control the keys used to encrypt and sign your data." In the AWS CLI reference, the description is even more direct: "Key Management Service (KMS) is an encryption and key management web service."

In practice you use KMS to do four things:

  • Create keys — symmetric encryption keys (one key that both encrypts and decrypts), asymmetric key pairs (a public and private key, used for encryption or digital signatures), HMAC keys (for message authentication codes), and post-quantum signing keys (ML-DSA, for future-proofing against quantum computers).
  • Control who can use them — through key policies (rules attached directly to the key), IAM policies (your account-wide permissions), and temporary grants (short-term permissions for AWS services to use your key).
  • Use them — encrypt and decrypt up to 4,096 bytes directly, generate data keys for envelope encryption of anything larger, sign and verify data, generate and verify MACs.
  • Manage their lifecycle — enable automatic rotation, create multi-Region replicas, import your own key material, and schedule deletion with a 7–30 day waiting period.

One terminology note that trips up long-time AWS users: AWS replaced the term customer master key (CMK) with KMS key. The concept did not change — only the name. So if you see "CMK" in an older script or policy, it means the same thing as today's KMS key.

How AWS KMS encryption works: envelope encryption and data keys

The AWS documentation describes KMS's architecture in one line that explains almost everything: "Root key protect the data keys that protect your data." That hierarchy is what makes KMS both fast and manageable.

The pattern is called envelope encryption: "the practice of encrypting plaintext data with a data key, and then encrypting the data key under another key" — that other key being your KMS key. Think of it like this: instead of locking a whole warehouse with one master key (slow, risky), you lock each box with its own small lock (the data key), then lock all those small keys in one safe (your KMS key).

The important constraint: AWS KMS cannot use a data key to encrypt data. The data key is meant to travel — you use it outside KMS, with tools like OpenSSL or the AWS Encryption SDK. KMS only encrypts and decrypts the small data key itself. That keeps the expensive encryption local and the calls to KMS minimal.

The envelope encryption flow, step by step

  1. Your application asks KMS for a data key by calling GenerateDataKey. KMS returns two things: a plaintext data key (ready to use) and an encrypted copy of that same data key, locked under your KMS key.
  2. Your application uses the plaintext data key locally (for example, with AES-256) to encrypt your actual data — a file, a database row, an S3 object.
  3. Your application stores the encrypted data together with the encrypted data key. The plaintext data key is thrown away as soon as possible.
  4. To decrypt later, your application sends only the encrypted data key back to KMS via Decrypt. KMS unlocks it and returns the plaintext data key.
  5. Your application uses that recovered data key to decrypt the data locally, then discards it again.

Every KMS-encrypted S3 object, EBS volume, or RDS database you have ever touched was almost certainly built on this pattern — the service does the envelope work for you, and KMS holds the root key.

The three types of KMS keys

Not every key in AWS is one you created. AWS splits keys into three buckets, and the differences matter for control, cost, and compliance.

  • AWS owned keys — a collection of keys that AWS owns and manages, not in your account, used to protect data across multiple AWS customers. You do not see or manage these. When a service says "encrypted with an AWS owned key," that is what it means.
  • AWS managed keys — KMS keys in your account, but created, managed, and used on your behalf by an AWS service integrated with KMS — for example, alias/aws/s3 for Amazon S3. You can view them, but you do not control their key policy or rotation schedule. They are the "default" encryption choice when you enable encryption in a service without picking your own key.
  • Customer managed keys — the keys "you create and manage for use in your own cryptographic applications." You control the key policy (who can use the key), aliases (friendly names), rotation, deletion, and billing. These are the keys you reach for when compliance or control matters.
Key type Who creates it Key policy control Rotation Best for
AWS owned AWS, across accounts None (invisible to you) Managed by AWS AWS-managed services that do not need per-customer keys
AWS managed (e.g., aws/s3) AWS service, on your behalf View only; cannot restrict Automatic, managed by AWS Fast start, low overhead, no compliance requirement to control the key
Customer managed You Full — you write the key policy Optional: automatic (365 days) or on-demand Anything where you need to restrict access, audit, or own the lifecycle

 What changed between versions

  • Before: keys you created were called customer master keys (CMKs).
  • Now: AWS KMS uses the term KMS key; the concept has not changed.
  • What that means for you: any script, policy, or blog post still saying "CMK" means exactly what a KMS key means today.

Who holds the keys to your data: the honest answer

This is the question the title asks, and the answer depends entirely on which key arrangement you choose. The blunt version:

  • AWS owned keys: AWS holds and controls everything. You have no visibility or control.
  • AWS managed keys: The key material is in your account, but AWS manages the policy and rotation. You cannot restrict who uses it beyond what the integrated service allows.
  • Customer managed keys (default): You control the key policy — the single document that says who can use the key. The key material itself is generated and protected "via FIPS 140-3 validated HSMs" that AWS operates. AWS personnel cannot extract the material, and cannot use the key without permissions you grant. An HSM (hardware security module) is a tamper-resistant physical device certified to the U.S. government's FIPS 140-3 security standard — think of it as a vault for key material.
  • Customer managed keys with imported material (BYOK): You generate the key material yourself, import it into KMS (wrapped), and manage its expiry. KMS stores it in its HSMs.
  • External key store (XKS): The key material never leaves your own key manager or HSM. KMS connects out to an "external key store proxy" — a small service you run that talks to your key manager — and KMS operations fail if that proxy is unreachable.
Key arrangement Where the key material lives Who can use it Failure mode
Customer managed (AWS material) FIPS 140-3 validated HSMs owned by AWS Principals allowed by your key policy, IAM policies (if the key policy permits), and grants If you schedule deletion and the 7–30 day wait expires, the key is gone and data encrypted under it is unrecoverable
Customer managed (imported material) Your HSM or generator, then stored encrypted in KMS Same as above, plus you manage material expiry If the imported material expires or is deleted, same outcome as key deletion
External key store (XKS) Your external key manager/HSM, via a proxy you run Your key manager decides; KMS requests operations through the proxy If the key store is disconnected, "all attempts to create KMS keys to use existing KMS keys in cryptographic operations will fail"
AWS managed (e.g., aws/s3) AWS HSMs, in your account AWS service policy; you cannot restrict Managed by AWS; you cannot disable or delete

‍♂️ Jake's Reality Check

"Wait — so AWS literally has the physical hardware with my key on it? Can Amazon just read my customer records?"

The straight answer: No. The material sits inside FIPS 140-3 validated HSMs that AWS operates, but the HSMs are designed so the key material never leaves in plaintext and AWS staff cannot use your key without the permissions in your key policy. If your compliance requirement is that AWS never touches the material at all, use an external key store — the material stays in your HSM and KMS calls out to it. What AWS does hold is the availability and integrity of the HSM infrastructure. That is the trade.

AWS KMS key policies, IAM policies, and grants

Access control in KMS is a two-door system, and you have to understand both doors or you will lock yourself out.

Door 1: the key policy. A key policy is a resource policy — a set of rules attached directly to the key itself. It is the primary way to control access to KMS keys, and every KMS key must have exactly one. If the key policy does not allow a principal (an IAM user, role, or AWS service), the request fails — even for an account administrator. This is why KMS is different from most AWS services: IAM alone is never enough.

Door 2: IAM policies. To use an IAM policy to control access to a KMS key, the key policy for the KMS key must give the account permission to use IAM policies. The default key policy that KMS creates does exactly that — it allows the account to use IAM policies to delegate permission for all actions on the KMS key. Without that statement, IAM policies are ignored for that key.

Temporary delegation: grants. A grant is a policy instrument that allows AWS principals to use KMS keys in cryptographic operations. Grants are how AWS services like S3, Lambda, and EBS get permission to use your customer-managed keys without you listing every service role in the key policy. Grants are advanced mechanisms for specifying permissions that you or an AWS service integrated with AWS KMS can use to specify how and when a KMS key can be used. Grants can be constrained — for example, with an "encryption context constraint" that restricts permissions based on the encryption context in the request.

How KMS decides whether to allow a request

  1. A request arrives (for example, Decrypt) from a principal — an IAM user, role, or AWS service.
  2. KMS evaluates the key policy. If the key policy explicitly denies the action, the request is denied.
  3. If the key policy allows the account to use IAM policies, KMS also evaluates the principal's IAM policies.
  4. KMS checks for any active grants that allow the action for that principal.
  5. KMS allows the request only if the combined evaluation permits it. AWS KMS evaluates these policy mechanisms together to determine whether access to the KMS key is allowed or denied.

The default key policy is a good starting point. When you create a key in the console, KMS adds statements that let key administrators manage the key and key users perform cryptographic operations. For a symmetric encryption key, key users get actions like these:

{
  "Sid": "Allow use of the key",
  "Effect": "Allow",
  "Principal": {"AWS": "arn:aws:iam::111122223333:role/ExampleKeyUserRole"},
  "Action": [
    "kms:Decrypt",
    "kms:DescribeKey",
    "kms:Encrypt",
    "kms:GenerateDataKey*",
    "kms:ReEncrypt*"
  ],
  "Resource": "*"
}

To view the policy for a key you already have, run aws kms get-key-policy --key-id <key-id> --policy-name default — the get-key-policy CLI command is the documented way to read it back.

AWS KMS key rotation

Key rotation is where KMS quietly does the right thing. AWS KMS automatically rotates the KMS key on the rotation date defined by your rotation period. The default rotation period is 365 days. When you enable automatic key rotation for a KMS key, AWS KMS generates new cryptographic material for the KMS key every year.

The rotation is non-disruptive: after rotation, AWS KMS uses the current key material for both encryption and decryption, and the non-current key material for decryption operations only. Old ciphertext stays readable; new encryption uses the new material.

For symmetric encryption KMS keys, you can also trigger on-demand rotation — an immediate rotation outside the annual schedule. On-demand rotation is subject to its own resource quota. For other key types (asymmetric, HMAC), plan a manual rotation pattern: create a new key, update your alias to point at it, and re-encrypt data over time.

✅ Why this is the one to use

If you are running a customer-managed symmetric key, enable automatic key rotation. It costs nothing extra, it satisfies most compliance frameworks that demand annual rotation, and it removes one more thing you have to remember. The only time to leave it off is when a compliance regime specifically forbids automatic rotation — which is rare.

Multi-Region keys, aliases, and imported key material

Three features handle the edge cases where a plain single-Region key is not enough.

Aliases: friendly names that you can repoint

An alias is a name like alias/ExampleAlias or, for AWS managed keys, alias/aws/s3 — the aws/ prefix is reserved and cannot be used for your own aliases. At any given time, an alias ARN identifies one particular KMS key. However, because you can change the KMS key associated with the alias, the alias ARN can identify different KMS keys at different times. That repointing is the superpower: your application references alias/prod-data, and when you rotate or migrate keys, you update the alias, not the code.

Multi-Region keys

Multi-Region keys have key IDs that begin with the mrk- prefix and ARNs that work across Regions. You create a primary key and then create replica keys in other Regions; the replicas share key material so data encrypted in one Region can be decrypted in another. This is the cleanest way to build a multi-Region disaster-recovery story without shipping ciphertext around.

Imported key material (BYOK)

"Create a KMS key with imported key material" is a documented four-step process:

  1. Create a KMS key without key material (origin: EXTERNAL).
  2. Download the wrapping public key and import token from KMS.
  3. Encrypt your own key material with the wrapping public key (outside AWS).
  4. Import the wrapped key material back into KMS.

Once imported, you are responsible for the material's lifecycle — including expiration. If the imported material expires or is deleted, the key behaves as if deleted: data encrypted under it becomes unrecoverable.

Using AWS KMS with S3, RDS, EBS, and other services

Every major AWS storage and database service integrates with KMS, but each does it slightly differently. Here are the traps.

Amazon S3: the default is not what you think

The surprise: "By default, all buckets have a default encryption configuration that uses server-side encryption with Amazon S3 managed keys (SSE-S3)". Your data is already encrypted — but with an S3-managed key, not a KMS key you control. To use KMS, you set the SSE algorithm to aws:kms (or aws:kms:dsse for directory buckets) and specify a KMSMasterKeyID — which can be the key ID, key ARN, or key alias.

Two limits documented in the S3 CLI reference: "Amazon S3 only supports symmetric encryption KMS keys" — asymmetric KMS keys will not work with SSE-KMS — and for cross-account operations you must use the fully qualified key ARN, not an alias, because "KMS resolves the key within the requester's account" when you use an alias.

To cut KMS request volume and cost on high-throughput buckets, enable S3 Bucket Keys: setting the BucketKeyEnabled element to true causes Amazon S3 to use an S3 Bucket Key for new objects in the bucket.

⚠️ What this actually breaks

If you point SSE-KMS at an asymmetric KMS key, uploads will fail — S3 requires symmetric encryption KMS keys. And if you use a key alias for cross-account access, S3 resolves it in the requester's account, which can silently encrypt data under the wrong account's key. Use the full key ARN for anything cross-account.

Amazon RDS: encrypt only at creation, and snapshots inherit the key

Amazon RDS encrypted DB instances use the industry standard AES-256 encryption algorithm, and RDS uses a KMS key to protect the storage, snapshots, and read replicas. The hard limits, straight from the RDS User Guide:

  • "You can only encrypt an Amazon RDS DB instance when you create it, not after the DB instance is created" — the workaround is snapshot → encrypted copy → restore.
  • "A snapshot of an encrypted DB instance must be encrypted using the same KMS key as the DB instance" — you cannot re-key a snapshot on copy within the same account.
  • You cannot mix encrypted and unencrypted resources in a replica or restore chain.

EBS, WorkSpaces, ElastiCache, and the rest

Amazon EBS encryption uses AWS KMS keys when creating encrypted volumes and snapshots. WorkSpaces is integrated with AWS KMS, which enables you to encrypt storage volumes of WorkSpaces using a KMS key. ElastiCache supports customer-managed KMS keys, and by default an AWS-owned KMS key is used to encrypt data. The same pattern repeats across DynamoDB, Lambda, SQS, and more: default encryption with an AWS-owned or AWS-managed key, and the option to bring your own customer-managed key if you need control.

Hands-on: AWS KMS CLI encrypt and decrypt example

The fastest way to understand KMS is to encrypt something. The aws kms CLI commands are documented in the AWS CLI Command Reference, and the two you will use most are encrypt and decrypt.

A complete encrypt/decrypt walkthrough

  1. Create a key. aws kms create-key --description "demo-key". Note the KeyId in the output.
  2. Create an alias so you do not have to paste the key ID: aws kms create-alias --alias-name alias/demo --target-key-id <key-id>.
  3. Encrypt a short string. The Encrypt operation handles plaintext of up to 4,096 bytes for a symmetric key:
    echo -n "hello kms" | aws kms encrypt \
      --key-id alias/demo \
      --plaintext fileb:///dev/stdin \
      --output text --query CiphertextBlob \
      > encrypted.b64
  4. Decrypt it back. The Decrypt operation reverses ciphertext from Encrypt, GenerateDataKey, and related operations:
    aws kms decrypt \
      --ciphertext-blob fileb://<(base64 -d encrypted.b64) \
      --output text --query Plaintext \
      | base64 -d
  5. Generate a data key for anything bigger than 4 KB — aws kms generate-data-key --key-id alias/demo --key-spec AES_256 — and use the plaintext key locally with OpenSSL or your app's crypto library.

If you use an asymmetric key for encryption, you must also specify the EncryptionAlgorithm, and the size limits shrink — for example, an RSA_2048 key with RSAES_OAEP_SHA_256 can encrypt only 190 bytes. Symmetric keys are the default for a reason.

For signing, the sign CLI command generates a cryptographic signature for a short message. The output of the command includes a base-64 encoded Signature field. The Sign API and SDK examples cover Java, PHP, Python, and more.

From CLI to code

The same operations exist in every AWS SDK. The PHP SDK documentation, for instance, shows Encrypt, Decrypt, and ReEncrypt with full sample code, and the Go SDK covers encrypting data with KMS keyrings. Java developers will find CreateKeyRequest supports external key stores via the XksKeyId parameter. For infrastructure-as-code, KMS keys are manageable through CloudFormation and Terraform resources — check the current schema for your tool.

AWS KMS vs Secrets Manager vs CloudHSM vs HashiCorp Vault

These four get confused constantly, and the confusion costs money. The short version: KMS manages keys, Secrets Manager manages secrets, CloudHSM gives you a dedicated HSM, and Vault is an external tool that can do both.

AWS's own documentation draws the KMS/Secrets Manager line clearly: "Secrets Manager is purpose-built for managing secrets such as database credentials, API keys, and supported third-party software-vended secrets" — and Secrets Manager uses KMS keys to encrypt those secrets. A key policy can even allow users in other accounts "to encrypt the secrets they store in AWS Secrets Manager." So: Secrets Manager handles secret lifecycle (storage, rotation, retrieval); KMS handles the encryption underneath.

CloudHSM is a different animal: "AWS CloudHSM allows you to generate, import, and manage cryptographic keys on a FIPS 140-2 level 3 validated HSM" — a single-tenant HSM cluster you manage. KMS can even be backed by CloudHSM through a custom key store, giving you KMS's API with CloudHSM's dedicated hardware. Use CloudHSM when you need direct, low-level key control for compliance; use KMS for everything else because it is managed, integrated, and cheaper to operate.

HashiCorp Vault and Azure Key Vault sit outside AWS. Vault is a secrets and encryption tool you can run yourself (or via HCP) across any cloud or on-premises; Azure Key Vault is Microsoft's cloud equivalent for keys, secrets, and certificates. If you are multi-cloud or need a self-managed option, they are the comparison set — but for AWS-native workloads, KMS is the default because it is already wired into every AWS service.

Service What it manages Best for Trade-off
AWS KMS Encryption and signing keys AWS-native encryption, signing, envelope encryption Per-key and per-request billing; AWS holds the HSMs (unless XKS)
AWS Secrets Manager Secrets (credentials, API keys) with rotation and retrieval Storing and rotating database passwords, tokens Uses KMS underneath; you still need a KMS key
AWS CloudHSM Dedicated FIPS 140-2 Level 3 HSM cluster Compliance requiring single-tenant HSMs, direct PKCS#11/JCE access You manage the cluster; higher operational cost
HashiCorp Vault Secrets and encryption across clouds/on-prem Multi-cloud or self-managed secrets and encryption Not native to AWS; you run it (or pay for HCP)
Azure Key Vault Keys, secrets, and certificates in Azure The Azure equivalent when your workload is there Not for AWS workloads

AWS KMS pricing: is AWS KMS free?

No. AWS KMS is not free, and this is the billing surprise that catches almost everyone once.

The AWS knowledge center on re:Post states it plainly: "You're billed for all active or deactivated KMS keys on your account. You're also charged for the API requests that are made to the AWS Key Management Service." In other words, keys bill while they exist, whether or not you use them, and every Encrypt, Decrypt, GenerateDataKey, and Sign call adds to the request meter.

A historical data point from AWS re:Post describes customer-managed keys at roughly $1 per key per month, plus per-request charges. The exact per-key and per-request numbers vary by Region and can change, so treat that as an order of magnitude and read the current numbers on the AWS KMS pricing page. AWS also notes that using KMS "does not require contracts or minimum purchases."

The way to keep the bill sane is the way you keep any metered bill sane: delete keys you are not using, use S3 Bucket Keys to reduce per-object KMS calls on high-volume buckets, and do not create a separate key per S3 bucket unless you truly need isolation.

‍♂️ Jake's Reality Check

"I got my first AWS bill and there's a line for KMS keys I forgot I created during a demo six months ago. Is that a mistake?"

The straight answer: It is not a mistake. AWS bills for every active or deactivated key in your account. A key sitting idle still costs its monthly charge. Ethan's fix for Jake: schedule deletion for anything you are not using — remember the 7–30 day waiting period — and consolidate keys so one key serves a whole application instead of one per bucket or per table.

AWS KMS best practices

These are the practices that separate a KMS setup that survives an audit from one that wakes you up at 2 a.m.

  1. Use customer-managed keys for anything that matters. AWS managed keys are fine for getting started, but you cannot restrict their use — which fails most compliance reviews.
  2. Enable automatic key rotation on symmetric encryption keys. The default rotation period is 365 days, and rotation is non-disruptive. This is the single highest-value setting in KMS.
  3. Treat the key policy as the source of truth. It is the primary way to control access. Grant key administrator and key user roles explicitly, and only allow IAM delegation when you actually intend to use it.
  4. Use encryption context. It is optional for symmetric keys but strongly recommended: when you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data — otherwise you get an InvalidCiphertextException. Keep it non-secret (it appears in CloudTrail logs).
  5. Use aliases for indirection. Reference alias/prod-data in your code, not the key ID. When you need to rotate or migrate, update the alias — the application does not change.
  6. One key per data domain, not per object. Separate keys for customer PII, payment data, and logs. This lets you revoke access and schedule deletion independently.
  7. Guard key deletion. Scheduling deletion requires a 7–30 day waiting period, and AWS KMS never deletes your KMS keys unless you explicitly schedule them for deletion and the mandatory waiting period expires. That wait is your last chance to cancel.
  8. Audit with CloudTrail. KMS logs API calls to CloudTrail, which records who did what and when. Turn it on and actually look.
  9. Use multi-Region keys for DR. Create a primary and replicas so encryption survives a Regional failure.
  10. Enable S3 Bucket Keys on high-throughput S3 buckets to reduce KMS request volume and cost.

✅ Why this is the one to use

Ethan's default for Jake: one customer-managed symmetric key per data domain, automatic rotation on, a least-privilege key policy, and an alias referenced from code. That configuration is cheap, auditable, recoverable, and it will pass almost any security review. Everything fancier — multi-Region, XKS, BYOK — is for when you have a specific reason.

AWS KMS quotas, errors, and what to do when nothing works

KMS has hard limits and failure modes that are worth knowing before you hit them.

Quotas

You can have up to 100,000 customer managed keys in each Region of your AWS account. KMS also enforces per-second request quotas on API operations; all AWS KMS request quotas are adjustable — you can request increases — except for the on-demand rotation resource quota and the AWS CloudHSM key store request quota. If you are being throttled, you will see request-rate errors; the fix is a quota increase, client-side retry with backoff, or architectural changes like S3 Bucket Keys.

The errors that actually happen

  • InvalidCiphertextException on decrypt — the classic cause is a mismatched encryption context: you must specify the same encryption context (a case-sensitive exact match) when decrypting the data, or the request fails with this error. The other cause is trying to decrypt with a different key than the one that encrypted.
  • AccessDeniedException — the key policy does not allow the principal, or the key policy does not permit IAM policies and you tried to use IAM. Run aws kms get-key-policy and read the policy.
  • Custom key store failures — while a custom key store is disconnected, all attempts to create KMS keys or use existing KMS keys in cryptographic operations will fail. For an external key store, check that the proxy is reachable and the key store is connected.
  • Key pending deletion — if a key is inside its 7–30 day deletion window, cryptographic operations fail. You can cancel with aws kms cancel-key-deletion.

When nothing works

The one unrecoverable failure in KMS is a deleted key. Once the waiting period expires, the key material is gone and everything encrypted under it is gone with it — there is no backdoor, and that is by design. Before you schedule deletion: export what you need, verify with aws kms describe-key, and give yourself the full 30 days.

AWS KMS FAQ

What is the full form of AWS KMS?

AWS Key Management Service. AWS documentation describes it as "an encryption and key management service scaled for the cloud" that "makes it easy for you to create and control the keys used to encrypt and sign your data."

Who holds the keys to my data in AWS KMS?

It depends on the key. With AWS owned and AWS managed keys, AWS holds and controls the key. With a standard customer-managed key, AWS holds the key material inside FIPS 140-3 validated HSMs, but you control the permissions through the key policy. With an external key store (XKS), the key material never leaves your own HSM or key manager.

Is AWS KMS free?

No. AWS bills for every active or deactivated KMS key in your account, plus per-request charges for API calls. There is no meaningful always-free allowance for KMS keys.

How much does AWS KMS cost?

KMS is metered two ways: a monthly charge per key (historically around $1 per customer-managed key per month) and per-request charges that vary by operation and Region. Check the AWS KMS pricing page for current numbers, and use the AWS Pricing Calculator to estimate your workload.

What is the difference between AWS KMS and Secrets Manager?

KMS manages encryption and signing keys. Secrets Manager manages secrets — "database credentials, API keys, and supported third-party software-vended secrets" — including their storage, rotation, and retrieval, and it uses KMS keys to encrypt them. Use Secrets Manager to store a password; use KMS to control the key that encrypts it.

What is envelope encryption in AWS KMS?

"Envelope encryption is the practice of encrypting plaintext data with a data key, and then encrypting the data key under another key" — your KMS key. KMS cannot use the data key to encrypt data; you use it outside KMS, then use KMS only to decrypt the data key when needed.

What is a KMS key policy?

A resource policy attached to every KMS key. "Key policies are the primary way to control access to KMS keys. Every KMS key must have exactly one [key policy]." If the key policy does not allow a principal, the request is denied regardless of IAM.

How does AWS KMS key rotation work?

For symmetric encryption KMS keys, AWS KMS can automatically rotate the key material. "The default rotation period is 365 days," and after rotation the current material handles encrypt and decrypt while the non-current material handles decrypt only. On-demand rotation is also available, subject to a quota.

Can I bring my own key (BYOK) to AWS KMS?

Yes, two ways. For symmetric keys, create a key with no material, download the wrapping public key and import token, encrypt your material, and import it. For stronger control, use an external key store (XKS), where the key material stays in your own key manager and KMS connects via a proxy.

What is an external key store (XKS) in AWS KMS?

A custom key store where the key material lives in an external key manager you control, outside AWS. KMS connects to it through an external key store proxy; if the key store is disconnected, all cryptographic operations on those keys fail.

Does AWS KMS use HSMs?

Yes. "AWS KMS protects root keys via FIPS 140-3 validated HSMs." KMS also offers FIPS 140-2 validated endpoints for Regions that require them, and can use AWS CloudHSM (FIPS 140-2 Level 3) as a backing for custom key stores.

What encryption algorithms does AWS KMS support?

Key specs include SYMMETRIC_DEFAULT (AES-256), RSA, ECC, HMAC, ML-DSA (post-quantum signing), and SM2 (in China Regions). The Encrypt operation on a symmetric key handles up to 4,096 bytes; asymmetric limits vary by key size and algorithm.

How do I use AWS KMS with Amazon S3?

Set the bucket's server-side encryption to SSE-KMS (aws:kms) and specify a customer managed key by key ID, ARN, or alias. S3 only supports symmetric encryption KMS keys, and for cross-account operations you must use the fully qualified key ARN. Enable S3 Bucket Keys to reduce KMS request volume.

How do I use AWS KMS with Amazon RDS?

Enable encryption when you create the DB instance; you cannot encrypt an existing instance directly (snapshot → encrypted copy → restore is the workaround). Snapshots of encrypted instances must use the same KMS key, and you cannot mix encrypted and unencrypted resources in replica or restore chains. RDS uses AES-256 under the hood.

What are AWS KMS aliases?

Friendly names (like alias/prod-data) that point to a KMS key. "Because you can change the KMS key associated with the alias, the alias ARN can identify different KMS keys at different times" — which makes them ideal for key rotation and migration without code changes. The aws/ prefix is reserved for AWS managed keys.

What are AWS KMS best practices?

Use customer-managed keys for anything sensitive; enable automatic key rotation on symmetric keys; control access primarily through least-privilege key policies; use encryption context (and match it exactly on decrypt); use aliases for indirection; separate keys per data domain; guard key deletion (7–30 day wait); audit with CloudTrail; and use S3 Bucket Keys on high-volume buckets.

Also Read:

Revision note. Written September 2026. If you have been fighting a KMS permission error or a surprise bill at 11 p.m., I hope this is the page that finally makes it click. Happy learning!


Related