aws / aws/containers-roadmap

[ECS] [request]: Fargate EFS volume mount working example in CDK

Open
#1,090 20 comments 19 reactions 0 assignees View on GitHub
ECS Fargate Proposed
Dominant language
Shell
Stars
5.4k
Forks
334
PR merge metrics
No merged PRs in 30d

Description

### Community Note

* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment

**Tell us about your request**
Provide a working example of EFS volume mount with 1.4.0 Fargate in which container running as non-root user can actually write data to EFS.

**Which service(s) is this request for?**
Fargate, ECS

**Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?**
My problem is mostly similar to #863 . I am running two containers in a task. Apache-alpine and PHP-fpm. I am not using bind-mount/mount points in my task definition. Dockerfile has a VOLUME instruction which maps to /usr/local/apache2/htdocs

My task is able to mount EFS volume successfully. Apache container runs on www-data user. Apache and PHP-FPM via proxy working fine. When apache wants to write/create a new file, it is able to do that. However, EFS volume size never increases from default 6 Kb. This tells me that all the new files are written to temporary disk space and not to EFS.

From the issue solution #863 I think defining the **VOLUME** in Dockerfile would actually be able to write files in EFS volume and apache would be able to read/write/execute files from there. Obviously, that is not happening.

I also thought, if my script creates a new file, that would go to EFS volume as it is mounted successfully with access point. It is not happening either.

I have gone through all the parts of this blog post: https://aws.amazon.com/blogs/containers/developers-guide-to-using-amazon-efs-with-amazon-ecs-and-aws-fargate-part-1/ = didn't work.

Not sure what I am missing.

**So, can someone provide working example of simple apache webserver mount working with EFS + FARGATE.** in CDK?

**Are you currently working around this issue?**
How are you currently solving this problem?
I have tried efs mount with access point, with IAM authorization + access point, without access point, with chown **/usr/local/apache2/htdocs** to www-data:www-data and without chowning it.

None of above has worked.

**Additional context**
Anything else we should know?
Securitygroups are fine as temporary EC2 instance created with the securitygroup is able to mount and write file to efs successfully.
IAM permission to task roles are allowed for
"elasticfilesystem:ClientWrite",
"elasticfilesystem:ClientRootAccess",
"elasticfilesystem:ClientMount",

EFS volume has created a **/usr/local/apache2/htdocs** which I can confirm, but there is no files into it as I mentioned.

**Attachments**
If you think you might have additional information that you'd like to include via an attachment, please do - we'll take a look. (Remember to remove any personally-identifiable information.)

Contributor guide

Open the contributing guide

Research direction

No repository file or test is named in the issue. Start by reviewing the related issue #863 and the linked AWS EFS/Fargate blog post, then reproduce the reported setup; done means a documented CDK example where a non-root Apache/PHP-FPM container writes files that appear on EFS.

Written by the indexing model from the issue text.

Assessment

Tech stack
apache, aws, docker, php
Domain
cloud, infrastructure
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.