ECS: Mount EFS volume
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
I want to be able to create an EFS volume and mount it in a docker container with CDK.
I tried figuring out how to use an Access Point but can't figure out how to specify the AP ID in a `Volume` definition. Don't see anything about access points in ECS docs.
I tried creating an EFS volume and mounting it but I can't write to it and I have no way to change the permissions. I'm using a community docker image I'd rather use as-is without modifying.
Surely this is a common use case - create a writeable persistent volume and mount it.
### Use Case
I'm building this - https://github.com/jetbridge/lemmy-cdk
### Proposed Solution
A way to mount an EFS access point in a fargate task definition or a way to mount the entire EFS volume as writeable.
### Other
```typescript
const fs = new FileSystem(this, "FS", {
vpc,
encrypted: true,
lifecyclePolicy: LifecyclePolicy.AFTER_60_DAYS,
performanceMode: PerformanceMode.GENERAL_PURPOSE,
removalPolicy: RemovalPolicy.RETAIN,
fileSystemName: "LemmyFS",
enableAutomaticBackups: false,
});
const assetVolume: Volume = {
efsVolumeConfiguration: {
fileSystemId: fs.fileSystemId,
},
name: "assets",
};
const container = taskDef.addContainer(PICTRS_NAME, {
image: ContainerImage.fromRegistry(PICTRS_IMAGE),
logging: LogDriver.awsLogs({ streamPrefix: PICTRS_NAME }),
environment: { PICTRS_PATH: "/mnt/assets" },
});
// mount asset storage volume
container.addMountPoints({
sourceVolume: assetVolume.name,
containerPath: "/mnt/assets",
readOnly: false,
});
```

* [ ] :wave: I may be able to implement this feature request
* [ ] :warning: This feature might incur a breaking change
---
This is a :rocket: Feature Request
Contributor guide
Research direction
Review the ECS task definition's Volume and efsVolumeConfiguration, along with the Fargate task definition and addMountPoints usage shown in the example. Compare the requested EFS access-point or writable-volume behavior with the current CDK model, and define completion as a task definition that mounts persistent EFS storage for the unchanged container image.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, docker, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100