Review the EFS customer managed KMS key

Specify EFS encryption and customer managed KMS key requirements when creating a file system.

Description

In community.aws.efs, encrypt: yes turns on encryption for a new file system. If you omit kms_key_id, EFS uses its AWS managed key.

Potential impact

A file system created with encrypt: no stores files unencrypted. Organizations that manage their own key policies need a customer managed key.

Remediation

When you need your own key, set kms_key_id at creation and verify its Region and permissions. Copy the existing data to a file system with a different creation token. If applications still write to the source, pause writes and complete a final sync. Check data consistency, file permissions and TLS mount access before switching clients.

Examples

Supply real key, subnet and security group values. Both tasks use name: myTestEFS as the same creation token, so rerunning the second task cannot change encryption on the existing file system.

Before

yaml
- name: EFS 생성
  community.aws.efs:
    state: present
    name: myTestEFS
    encrypt: no
    tags:
      Name: myTestNameTag
      purpose: file-storage
    targets:
      - subnet_id: subnet-748c5d03
        security_groups:
          - sg-1a2b3c4d

After

yaml
- name: EFS 생성
  community.aws.efs:
    state: present
    name: myTestEFS
    encrypt: yes
    tags:
      Name: myTestNameTag
      purpose: file-storage
    targets:
      - subnet_id: subnet-748c5d03
        security_groups:
          - sg-1a2b3c4d
    kms_key_id: some-key-id

References