Answers: <p>Underlying reason:</p>
  
  <p>The ECS service's network access security group did not have permission to access EFS.</p>
  
  <p>Solution:</p>
  
  <p>Add an inbound rule for type <code>NFS</code> in the security group as described in this tutorial: <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/tutorial-efs-volumes.html#efs-security-group" rel="noreferrer">https://docs.aws.amazon.com/AmazonECS/latest/developerguide/tutorial-efs-volumes.html#efs-security-group</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2020-04-29T09:34:37.173Z
Answers: 2020-04-29T09:34:37.173Z
Answers: stoft
Body: <p>When starting up an Amazon ECS task with launch type FARGATE it fails with the following reason:</p>
  
  <pre><code>ResourceInitializationError: failed to invoke EFS utils commands to set up EFS volumes: command failed with 32: failed to execute command to invoke EFS utils: mount.nfs4:
  
  Connection timed out
  </code></pre>
  
  <p>The fargate task is a docker image that needs to mount EFS as persistent storage. </p>
  
  <p>Why is the connection timing out?</p>
  
Comments: CC BY-SA 4.0
Comments: 2020-04-29T11:24:26.073Z
Comments: Could you please provide some more context to this? There doesn't seem to be a question asked either.
Comments: Bruce Becker
Comments: CC BY-SA 4.0
Comments: 2020-05-01T11:38:13.507Z
Comments: Thank you for the feedback. Edited with a proper question and a bit more context. Are there more improvements I could make?
Comments: stoft
Tags: <amazon-ecs><fargate><amazon-efs>
Title: Startup of ECS Fargate task fails with ResourceInitializationError mount.nfs4 Connection timed out
UserDisplayName: stoft
ThreadText: # Startup of ECS Fargate task fails with ResourceInitializationError mount.nfs4 Connection timed out
  
  (Asked by: username_0 on 2020-04-29)
  
  When starting up an Amazon ECS task with launch type FARGATE it fails with the following reason:
  
  ```
  ResourceInitializationError: failed to invoke EFS utils commands to set up EFS volumes: command failed with 32: failed to execute command to invoke EFS utils: mount.nfs4:
  
  Connection timed out
  
  ```
  
  The fargate task is a docker image that needs to mount EFS as persistent storage.
  
  Why is the connection timing out?
  
  **Tags:** amazon-ecs, fargate, amazon-efs
  
  > **Comments:**
  > **username_1**: Could you please provide some more context to this? There doesn't seem to be a question asked either.  
  > **username_0**: Thank you for the feedback. Edited with a proper question and a bit more context. Are there more improvements I could make?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-04-29. Score: 5 | Accepted answer
  
  Underlying reason:
  
  The ECS service's network access security group did not have permission to access EFS.
  
  Solution:
  
  Add an inbound rule for type `NFS` in the security group as described in this tutorial: <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/tutorial-efs-volumes.html#efs-security-group>
  
  
  ---
  
  