Key Policies and Access Control
What you'll learn: How to define who can use encryption keys for cryptographic operations and key management tasks using granular policies.
The Core Idea
Just creating encryption keys isn't enough—you must control who can use them and how. Key policies are authorization rules that determine which users, services, or applications can perform operations like encryption, decryption, key rotation, or deletion. Without proper access control, a key meant for encrypting sensitive customer data could accidentally be used by unauthorized services or deleted by the wrong team.
Think of it like a safe deposit box: the key exists, but the bank needs rules about who can open it, who can add items, and who can remove or destroy the box itself.
Policy Components
Principals: Define who gets access—IAM users, service accounts, applications, or roles.
Actions: Specify what they can do:
- Data plane operations:
Encrypt,Decrypt,GenerateDataKey(for application use) - Control plane operations:
CreateKey,RotateKey,DisableKey,ScheduleKeyDeletion(for administrators)
Resources: Which specific keys the policy applies to.
Conditions: Optional constraints like IP ranges, time windows, or encryption context requirements.
Separation of Duties
Best practice separates key users from key administrators. Your application might encrypt data but shouldn't be able to delete the key. Your security team might manage key rotation but shouldn't decrypt production data.
Many KMS systems use encryption context—additional authenticated data that must match during decryption—to ensure keys are only used in their intended context (e.g., specific database, customer ID, or environment).
Key Takeaway: Key policies enforce the principle of least privilege by separating cryptographic operations from administrative tasks, ensuring only authorized principals can perform specific actions on encryption keys.