Search code examples
amazon-web-servicesdockeramazon-elastic-beanstalkamazon-efsecs-taskdefinition

AWS Elastic Beanstalk EFS Mount Error: unknown filesystem type 'efs'


I am trying to mount my EFS to a multi-docker Elastic Beanstalk environment using task definition with Dockerrun.aws.json. Also, I have configured the security group of EFS to accept NFS traffic from EC2 (EB environment) security group.

However, I am facing with the error:

ECS task stopped due to: Error response from daemon: create ecs-awseb-SeyahatciBlog-env-k3k5grsrma-2-wordpress-88eff0a5fc88f9ae7500: VolumeDriver.Create: mounting volume failed: mount: unknown filesystem type 'efs'.

I am uploading this Dockerrun.aws.json file using AWS management console:

{
  "AWSEBDockerrunVersion": 2,
  "authentication": {
    "bucket": "seyahatci-docker",
    "key": "index.docker.io/.dockercfg"
  },
  "volumes": [
    {
      "name": "wordpress",
      "efsVolumeConfiguration": {
        "fileSystemId": "fs-d9689882",
        "rootDirectory": "/blog-web-app/wordpress",
        "transitEncryption": "ENABLED"
      }
    },
    {
      "name": "mysql-data",
      "efsVolumeConfiguration": {
        "fileSystemId": "fs-d9689882",
        "rootDirectory": "/blog-db/mysql-data",
        "transitEncryption": "ENABLED"
      }
    }
  ],
  "containerDefinitions": [
    {
      "name": "blog-web-app",
      "image": "bireysel/seyehatci-blog-web-app",
      "memory": 256,
      "essential": false,
      "portMappings": [
        {"hostPort": 80, "containerPort": 80}
      ],
      "links": ["blog-db"],
      "mountPoints": [
        {
          "sourceVolume": "wordpress",
          "containerPath": "/var/www/html"
        }
      ]
    },
    {
      "name": "blog-db",
      "image": "mysql:5.7",
      "hostname": "blog-db",
      "memory": 256,
      "essential": true,
      "mountPoints": [
        {
          "sourceVolume": "mysql-data",
          "containerPath": "/var/lib/mysql"
        }
      ]
    }
  ]
}

AWS Configuration Screenshots:

  1. EC2 Security Group (Automatically created by EB)
  2. EFS Security Group
  3. EFS networking

Solution

  • After searching the entire web, I didn't encounter any solution for this problem. I contacted with AWS Support. They told me that the issue is with missing "amazon-efs-utils" extension on EC2 instances created by Elastic Beanstalk and then I fixed the error by creating a file named efs.config inside .ebextensions folder:

    .ebextensions/efs.config

    packages:
      yum:
        amazon-efs-utils: 1.2
    

    Finally, I zipped the .ebextensions folder and my Dockerrun.aws.json file before uploading and the problem has been resolved.