Description
KMS rotation changes the key material used for new encryption. The ARN and policy stay the same, and KMS retains older material for decryption.
Potential impact
A key can miss its required rotation schedule. Rotation does not re-encrypt stored data or revoke compromised access.
Remediation
Check that the key type and origin support automatic rotation. Where required, set enable_key_rotation: true and verify the key’s rotation status and schedule. Plan replacement for unsupported keys and revoke compromised permissions separately.
Examples
Both tasks apply kms_key_policy_json. Supply valid JSON that preserves administrator access and grants only the required permissions. The example uses the legacy community.aws.aws_kms name for amazon.aws.kms_key.
Before
- name: Update the KMS key policy
community.aws.aws_kms:
alias: my-kms-key
policy: "{{ kms_key_policy_json }}"
state: present
enabled: true
After
- name: Update the KMS key policy
community.aws.aws_kms:
alias: my-kms-key
policy: "{{ kms_key_policy_json }}"
state: present
enabled: true
enable_key_rotation: true
The first task leaves rotation unspecified. The second explicitly enables it.