Elasticsearch encryption key configuration needs review

Check the actual encryption state and KMS key selection for an Elasticsearch domain.

Description

Check whether the domain is encrypted at rest and which KMS key it uses. Choose a customer managed key when you need to control the key policy and lifecycle.

Potential impact

Broad key administration can undermine separation of duties. Disabling or deleting a customer managed key in use can make domain data inaccessible.

Remediation

When enabling encryption on AWS::Elasticsearch::Domain, set EncryptionAtRestOptions.KmsKeyId to an approved symmetric KMS key. For a customer managed key, preserve service access and restrict who can disable or delete it. To change the key of an encrypted domain, migrate to a separately named domain and test access and recovery before switching.

Examples

Both excerpts set Enabled: true. The first omits the required key. The second takes the actual key ID or ARN through EncryptionKeyId. Choose an engine version that supports encryption and the instance type, and configure access policies and networking separately.

Key omitted

yaml
Parameters:
  ElasticsearchVersion:
    Type: String
Resources:
  ElasticsearchDomain:
    Type: AWS::Elasticsearch::Domain
    Properties:
      DomainName: test
      ElasticsearchVersion: !Ref ElasticsearchVersion
      ElasticsearchClusterConfig:
        InstanceType: t3.small.elasticsearch
      EncryptionAtRestOptions:
        Enabled: true
      EBSOptions:
        EBSEnabled: true
        VolumeSize: 20
        VolumeType: gp2

Key specified

yaml
Parameters:
  ElasticsearchVersion:
    Type: String
  EncryptionKeyId:
    Type: String
Resources:
  ElasticsearchDomain:
    Type: AWS::Elasticsearch::Domain
    Properties:
      DomainName: test
      ElasticsearchVersion: !Ref ElasticsearchVersion
      ElasticsearchClusterConfig:
        InstanceType: t3.small.elasticsearch
      EncryptionAtRestOptions:
        Enabled: true
        KmsKeyId: !Ref EncryptionKeyId
      EBSOptions:
        EBSEnabled: true
        VolumeSize: 20
        VolumeType: gp2

References