feat(lambda): add DirectS3Read support to S3 Files filesystem mounts
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Description
Lambda S3 Files now supports `DirectS3Read` in CloudFormation, letting customers control whether Lambda streams eligible reads directly from Amazon S3 (higher throughput) instead of routing through the S3 Files mount target. The L1 `CfnFunction.S3FilesConfigProperty` already exposes `directS3Read`, but there is no L2 support on the `FileSystem.fromS3FilesAccessPoint` construct.
[Configuring Amazon S3 Files access - AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/configuration-filesystem-s3files.html#configuration-filesystem-s3files-directreads)
### Proposed Solution
Add an optional `options` bag to the `FileSystem.fromS3FilesAccessPoint` factory carrying a `directS3Read` prop, typed as a new `DirectS3ReadMode` enum (`ENABLED` / `DISABLED` / `AUTO`):
```ts
new lambda.Function(this, 'MyFunction', {
// ...
filesystem: lambda.FileSystem.fromS3FilesAccessPoint(accessPoint, '/mnt/s3files', {
directS3Read: lambda.DirectS3ReadMode.ENABLED,
}),
});
```
`AUTO` (the service default) enables direct reads for functions configured with 512 MB or more of memory; `ENABLED` forces it on regardless of memory; `DISABLED` routes all reads through the file system.
### Acknowledgements
- [x] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
Contributor guide
Research direction
Start at the FileSystem.fromS3FilesAccessPoint entry point and inspect the existing CfnFunction.S3FilesConfigProperty.directS3Read support. Add the options and DirectS3ReadMode values described in the issue, then verify that synthesized Lambda configuration reflects ENABLED, DISABLED, and AUTO; AUTO should retain the service default behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100