AWS · Security, Identity, and Compliance

AWS Key Management Service (AWS KMS)

Create and control encryption keys used by AWS services and your applications, with every use logged and governed by key policies.

On the SAA-C03 exam listEncryption and key management

What it is and what problem it solves

AWS Key Management Service (KMS) creates and stores KMS keys in hardware security modules that never export the key material in plaintext. AWS services such as S3, EBS, RDS, DynamoDB and SQS call KMS to encrypt your data, and your applications can call it directly.

Large data is protected with envelope encryption: KMS generates a data key, the data is encrypted locally with it, and only the data key (encrypted by the KMS key) is stored alongside the data.

Keys come in three ownership types: AWS owned (invisible, used by services by default), AWS managed (per service in your account, such as aws/s3), and customer managed (you control the key policy, rotation, deletion and cross-account use). Multi-Region keys share key material across Regions.

KMS keynever leaves KMSGenerateDataKeyreturns 2 copiesPlaintext data keyuse, then discardEncrypted data keystore with the dataYour 2 GB fileencrypted locally (AES)encryptsStored togetherciphertext + encrypted keyTo decrypt: send the encrypteddata key to KMS (kms:Decrypt),get the plaintext key back.
Envelope encryption: KMS protects a small data key; the data key encrypts the large data locally

When to use it

  • Encrypting data at rest in AWS services with keys you can audit and control.
  • You must decide who can use a key, including other accounts, through key policies and grants.
  • You need automatic key rotation, or to disable or schedule deletion of a key as a kill switch.
  • Encrypting small secrets or data keys in your own application.

When to avoid it

  • You must have exclusive, single-tenant control of the HSMs (some regulations): use CloudHSM, optionally as a KMS custom key store.
  • Encrypting large payloads directly with the Encrypt call: use envelope encryption with data keys instead.
  • Storing secrets such as passwords: use Secrets Manager or Parameter Store (which use KMS underneath).

Scaling model and bottlenecks

KMS scales automatically, but cryptographic operations share a per-account, per-Region request-rate quota. Busy workloads that call KMS for every object can hit it; data key caching and S3 Bucket Keys reduce calls.

Performance, latency and throughput

Each KMS call is a network round trip, so envelope encryption (one call per data key, many local operations) is both faster and cheaper than calling KMS for every item.

Limits and quotas

ItemValueContextSource
Cryptographic operations (symmetric), requests per second 10,000
Can be raised with a quota request
Shared default; 20,000 in some Regions and 100,000 in US East (N. Virginia), US West (Oregon) and Europe (Ireland). Source
checked
Customer managed keys per Region 100,000
Can be raised with a quota request
Source
checked
Grants per customer managed key 50,000
Can be raised with a quota request
Source
checked
Aliases per KMS key 50
Can be raised with a quota request
Source
checked

Quotas and limits change. Check the linked source before designing around a number.

Cost model

What you pay for

  • Customer managed keys: a monthly charge per key (prorated hourly), plus a charge for the first and second rotations.
  • API requests, per 10,000, beyond a monthly free allowance; asymmetric operations are priced differently.
  • Not billed: AWS owned and AWS managed keys themselves (calls to AWS managed keys are billed), keys scheduled for deletion, and data keys apart from the request that creates them.

Where it is cost-efficient

A small number of customer managed keys used by services that cache data keys (S3 Bucket Keys, for example).

Where costs grow

Many customer managed keys created per tenant or per object, and high request volumes from services or apps that call KMS for every operation.

Cost controls and common surprises

Enable S3 Bucket Keys, cache data keys in applications, reuse keys where policy allows, and delete keys you do not need after their waiting period.

Prices differ by Region and change over time; see the pricing page linked under Sources.

Security

Controls the service provides

  • Key material is generated and used inside FIPS-validated HSMs and never leaves unencrypted.
  • Key policies are the primary access control; grants give temporary, narrow permissions.
  • Automatic rotation, a mandatory waiting period before deletion, and the ability to disable a key immediately.

What you configure

Write key policies that separate key administrators from key users, avoid wildcard principals, use encryption context in your applications, enable rotation, and monitor for disabled or pending-deletion keys.

Logging and monitoring

CloudTrail logs every use of a KMS key, so you can see who decrypted what and when.

Related security services

CloudHSM (custom key stores), Secrets Manager, S3, EBS, RDS and most storage services, IAM.

Shared responsibility

AWS secures the HSMs and the service. You control key policies, grants, rotation and who can use each key.

Availability, backup and failure behavior

KMS is regional and highly available within a Region. Data encrypted under a key in one Region needs that key to be readable; multi-Region keys let you decrypt in another Region for disaster recovery. Deleting a key makes its data unrecoverable, which is why deletion has a waiting period.

Common service combinations

S3 (SSE-KMS with Bucket Keys), EBS and RDS encryption, Secrets Manager, CloudTrail log encryption, Lambda environment variables, cross-account sharing with key policies.

Business application examples

  • A bank encrypts S3 data with a customer managed key that only two roles can use, and audits every decryption.
  • A multi-tenant app encrypts each tenant's data keys under a per-tenant key so one tenant's key can be disabled.

Exam cues and common confusions

  • Encrypt at rest, audit key use, control the key: a customer managed KMS key (SSE-KMS).
  • Encrypt more than a few KB: envelope encryption with data keys.
  • Single-tenant HSM, full control of the hardware: CloudHSM.
  • Decrypt in another Region for DR: multi-Region keys.
  • Throttling on KMS: request quota; use S3 Bucket Keys or data key caching.
  • Key deletion has a 7 to 30 day waiting period.

Related

Courses and lessons

Services, comparisons and patterns

Sources

Independent study material, not affiliated with or endorsed by Amazon Web Services. AWS and service names are trademarks of Amazon.com, Inc. or its affiliates.

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake