ECS EFS transport encryption needs review

Verify encryption in transit between ECS tasks and EFS. This setting is separate from encryption of data stored in the EFS file system.

Description

When an ECS task mounts EFS, EFSVolumeConfiguration.TransitEncryption protects file transfers between the task host and EFS. Check encryption at rest and file access permissions on the file system separately.

Potential impact

With DISABLED, file contents can be exposed along the network path. If a policy requires encrypted transport, the mount can fail and prevent the application from starting.

Remediation

Set TransitEncryption: ENABLED on the EFS volume in the task definition. EFS IAM authorization and access points require it. Deploy the new revision to your service or launch a standalone task with it, then verify the mount and the reads and writes your application needs.

Examples

Both EC2 task definitions require the EfsFileSystemId of an existing file system. Supply compatible ECS capacity, mount targets, a network path allowed by the security groups and mount permissions.

Transport encryption disabled

yaml
AWSTemplateFormatVersion: "2010-09-09"
Parameters:
  AppName:
    Type: String
    Default: simple-app
  EfsFileSystemId:
    Type: String
Resources:
  cluster:
    Type: AWS::ECS::Cluster
  taskdefinition:
    Type: AWS::ECS::TaskDefinition
    Properties:
      ContainerDefinitions:
        - Name: !Ref AppName
          MountPoints:
            - SourceVolume: my-vol
              ContainerPath: /var/www/my-vol
          Image: amazon/amazon-ecs-sample
          Memory: 128
      Volumes:
        - Name: my-vol
          EFSVolumeConfiguration:
            FilesystemId: !Ref EfsFileSystemId
            TransitEncryption: DISABLED

Transport encryption enabled

yaml
AWSTemplateFormatVersion: "2010-09-09"
Parameters:
  AppName:
    Type: String
    Default: simple-app
  EfsFileSystemId:
    Type: String
Resources:
  cluster:
    Type: AWS::ECS::Cluster
  taskdefinition:
    Type: AWS::ECS::TaskDefinition
    Properties:
      ContainerDefinitions:
        - Name: !Ref AppName
          MountPoints:
            - SourceVolume: my-vol
              ContainerPath: /var/www/my-vol
          Image: amazon/amazon-ecs-sample
          Memory: 128
      Volumes:
        - Name: my-vol
          EFSVolumeConfiguration:
            FilesystemId: !Ref EfsFileSystemId
            TransitEncryption: ENABLED

References