Sub topic 2
Who owns the key: AWS owned, AWS managed and customer managed
This chapter assumes you know basic IAM concepts (users, roles, policies), can run AWS CLI commands, and understand the difference between plaintext and ciphertext. It covers the three ownership categories of KMS keys. The choice decides who controls the key, what you can see, and what you pay.
The three categories
Every key that protects your data falls into one of three groups. They differ in who creates the key, who manages its policy, and how much you can observe.
| Property | AWS owned key | AWS managed key | Customer managed key |
|---|---|---|---|
| Visible in your account | No | Yes | Yes |
| Key policy | Hidden | Fixed by the service | You write it |
| Rotation | Set by AWS | Automatic, set by AWS | Optional, you control it |
| Can be disabled or deleted by you | No | No | Yes |
| Usage in CloudTrail | No | Yes | Yes |
| Monthly key charge | None | None | Yes |
AWS owned keys
An AWS owned key belongs to a service, and the service uses it across many customer accounts. You never see it in KMS, cannot audit its use, and cannot change its policy. Some services encrypt with one by default, such as DynamoDB tables that you have not configured otherwise. This option adds no cost and no setup. It does not give you control or an audit trail.
AWS managed keys
An AWS managed key is created in your account when you first use encryption in an integrated service. Its alias has the form alias/aws/<service>, for example alias/aws/s3. You can view the key and read its use in CloudTrail. You cannot edit its policy, disable it, or schedule it for deletion. The policy limits use of the key to your account, through the service.
Customer managed keys
A customer managed key is one you create yourself, as in the earlier create-key example. You write the key policy, decide on rotation, and can disable or delete the key. You also pay a monthly fee per key plus request charges. This is the only category that supports cross-account sharing, fine-grained policy conditions, and grants you create yourself.
Seeing the difference
The following commands list the keys in your account and show who manages each one.
# List aliases; AWS managed keys start with alias/aws/
aws kms list-aliases \
--query "Aliases[].AliasName" --output text
# Inspect one key and read its KeyManager field
aws kms describe-key \
--key-id alias/tutorial-key \
--query "KeyMetadata.KeyManager" --output textThe KeyManager field returns CUSTOMER for keys you manage and AWS for AWS managed keys. AWS owned keys never appear in these results.
How to choose
Use a customer managed key when you must prove who used the key, share data across accounts, or meet a policy that requires you to control the key lifecycle. Use an AWS managed key when you want an audit trail with no management work. Use an AWS owned key when the data has low sensitivity and the default protection is enough.
Exercise
A team stores S3 objects encrypted with the AWS managed key alias/aws/s3. A partner in another AWS account must now decrypt those objects. Why does this fail, and what should the team do?
Show answer
The AWS managed key's policy is fixed and cannot grant access to another account. The team should create a customer managed key with a policy that allows the partner account, then re-encrypt the objects with it, for example by copying them in place with the new key.
Exercise
Which command field tells you whether a key is managed by you or by AWS, and why will an AWS owned key never show up in it?
Show answer
The KeyManager field from aws kms describe-key shows CUSTOMER or AWS. An AWS owned key lives in a service's own account rather than in yours, so KMS in your account has no record of it to describe.