9

I have an AWS EFS share that I store container logs.

I would like to mount this nfs share (aws efs) to AWS Fargate. Is it possible?

Any supporting documentation link would be appreciated.

Squirrel
  • 1,283
  • 1
  • 13
  • 22

4 Answers4

9

You can do this since April 2020! It's a little tricky but works.

The biggest gotcha I ran into was that you need to set the "Platform version" to 1.4.0 - it will default to "Latest" which is 1.3.0.

In your Container Definitions you need to define a volume and a mountpoint where you want the EFS share mounted inside the container:

Volume:

     "volumes": [
        {
          "efsVolumeConfiguration": {
            "transitEncryptionPort": null,
            "fileSystemId": "fs-xxxxxxx",
            "authorizationConfig": {
              "iam": "DISABLED",
              "accessPointId": "fsap-xxxxxxxx"
            },
            "transitEncryption": "ENABLED",
            "rootDirectory": "/"
          },
          "name": "efs volume name",
          "host": null,
          "dockerVolumeConfiguration": null
        }
      ]

Mount volume in container:

 "mountPoints": [
         {
          "readOnly": null,
          "containerPath": "/opt/your-app",
          "sourceVolume": "efs volume name"
          }

These posts helped me although they're missing a few details:

Tutorial: Using Amazon EFS file systems with Amazon ECS

EFSVolumeConfiguration

Uberhumus
  • 921
  • 1
  • 13
  • 24
TheFiddlerWins
  • 860
  • 5
  • 19
  • 3
    Thank you x 1000. I wasted many hours fighting this just to realize that 'LATEST' doesn't actually work. What a mess – JamesSwift Jun 26 '20 at 01:10
  • Thank you so much. As @JamesSwift, I too fell faul of the platform Version. – Phil Jul 07 '20 at 18:41
1

EDIT: Since April 2020 this answer is not accurate. This was the situation until Fargate 1.4.0. If you are using earlier versions of Fargate this is still relevant, otherwise see newer answers.

Unfortunately it's not currently possible to use persistent storage with AWS Fargate however progress on this feature can be tracked using the newly launched public roadmap [1] for AWS container services [2]

Your use case seems to suggest logs. Have you considered using the AWSLogs driver [3] and shipping your application logs to CloudWatch Logs?

[1] https://github.com/aws/containers-roadmap/projects/1

[2] https://github.com/aws/containers-roadmap/issues/53

[3] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_awslogs.html

pete the pagan-gerbil
  • 3,136
  • 2
  • 28
  • 49
0

wow need platform version is 1.4.0 as @TheFiddlerWins suggested

Công Thắng
  • 275
  • 3
  • 5