I ran into a problem trying to mount an ECS Volume to EFS through an EFS access point.
The task role is set up with ClientWrite, ClientRead, and ClientRootAccess to that file system.
The access point is setup with posix userid 1001 and groupid 1001 with permission 755.
The cluster and the file system are in the correct VPC.
But ECS failed to spin up a task with this error:
Error response from daemon: failed to copy file info for /var/lib/ecs/volumes/{{task-name}}: failed to chown /var/lib/ecs/volumes/{{task-name}}
I was able to spin up the task if i set the access point's POSIX userid and groupid to 0 as in root. But i feel like its not the best choice for security reason in a shared FS.
After some general searches I form a hypothesis that after mounting the volume, the user of the container or its host was changed from root, which mess with the any further file/directory manipulation from the Dockerfile. AWS Access Points docs stated that:
When user enforcement is enabled, Amazon EFS replaces the NFS client's user and group IDs with the identity configured on the access point for all file system operations.
And because I think /var/lib/ecs/volumes/... is actually either the container or the host directory.
How could I circumvent this problem?
fyi: the task is run in a spot instance cluster so manually mount the volume is not an ideal solution in this case