Mounting an EFS file system in ECS on AWS Fargate

Since April 2020 it’s now possible to mount an EFS file system from a task running on AWS Fargate.

There are some things you need to set up to make it work:

Security group

Ensure that the task can mount the EFS file system. For this you need allow access on port 2049. Edit this security group and add the relevant rule:
AWS EFS security group

Service platform

This one was a bit tricky. You have to choose version 1.4.0 of the service platform when creating the service. LATEST will not work!
AWS ECS service platform version

Mount the EFS file system

In the container section of your task definition you can mount the EFS file system.
AWS ECS task definition configuration

This results in the following JSON in the task definition:

"mountPoints": [
    {
      "readOnly": null,
      "containerPath": "/test/monkey",
      "sourceVolume": "<NAME>"
    }
],
"volumes": [
    {
      "efsVolumeConfiguration": {
        "transitEncryptionPort": null,
        "fileSystemId": "fs-f38e9d38",
        "authorizationConfig": {
          "iam": "DISABLED",
          "accessPointId": "fsap-00539689e5a4c9907"
        },
        "transitEncryption": "ENABLED",
        "rootDirectory": "/"
      },
      "name": "<NAME>",
      "host": null,
      "dockerVolumeConfiguration": null
    }
  ]

Leave a Reply

Your email address will not be published. Required fields are marked *