New serverless pattern - lambda-s3-files-cdk#3075
New serverless pattern - lambda-s3-files-cdk#3075NithinChandranR-AWS wants to merge 3 commits intoaws-samples:mainfrom
Conversation
Deploy a Lambda function with an Amazon S3 Files file system mounted as a local directory, enabling standard file operations on S3 data without downloading objects. Key features: - S3 Files FileSystem with NFS mount on Lambda at /mnt/s3data - VPC with 2 AZs, mount targets, and access point (L1 constructs) - Security group for NFS traffic (port 2049) - Read, write, and list operations via standard fs module - Bidirectional sync between S3 bucket and mounted filesystem - Sub-millisecond latency on actively used data
Replace wildcard resource with specific S3 Files access point ARN for least-privilege IAM.
|
Thanks for submitting this pattern! Here's what needs to be addressed:
|
|
|
||
| ## How it works | ||
|
|
||
| [Amazon S3 Files](https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-files.html) (GA April 2026) provides NFS access to S3 buckets with full POSIX semantics. This pattern mounts an S3 bucket on a Lambda function at `/mnt/s3data`. |
There was a problem hiding this comment.
| [Amazon S3 Files](https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-files.html) (GA April 2026) provides NFS access to S3 buckets with full POSIX semantics. This pattern mounts an S3 bucket on a Lambda function at `/mnt/s3data`. | |
| [Amazon S3 Files](https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-files.html) provides NFS access to S3 buckets with full POSIX semantics. This pattern mounts an S3 bucket on a Lambda function at `/mnt/s3data`. |
|
|
||
| // Lambda function with S3 Files mount | ||
| const fn = new lambda.Function(this, "S3FilesFn", { | ||
| runtime: lambda.Runtime.NODEJS_22_X, |
There was a problem hiding this comment.
Why not use the latest runtime version?
There was a problem hiding this comment.
Upgraded to nodejs24.x via CDK escape hatch (L2 does not have NODEJS_24_X yet). Deployed and tested on a live stack — list, write, and read all pass. Fixed in f963437.
| @@ -0,0 +1,61 @@ | |||
| { | |||
| "title": "Lambda with Amazon S3 Files Mount", | |||
There was a problem hiding this comment.
| "title": "Lambda with Amazon S3 Files Mount", | |
| "title": "AWS Lambda with Amazon S3 Files Mount", |
There was a problem hiding this comment.
Updated to "AWS Lambda with Amazon S3 Files Mount". Fixed in f963437.
| "headline": "How it works", | ||
| "text": [ | ||
| "This pattern deploys a Lambda function with an Amazon S3 Files file system mounted at /mnt/s3data. The function performs standard file operations (read, write, list) on S3 data using the local filesystem — no S3 API calls needed.", | ||
| "S3 Files (GA April 2026) provides NFS access to S3 buckets with sub-millisecond latency on small files and full POSIX semantics. The pattern creates a VPC, S3 Files file system, mount targets, access point, and a Lambda function wired together.", |
There was a problem hiding this comment.
| "S3 Files (GA April 2026) provides NFS access to S3 buckets with sub-millisecond latency on small files and full POSIX semantics. The pattern creates a VPC, S3 Files file system, mount targets, access point, and a Lambda function wired together.", | |
| "S3 Files provides NFS access to S3 buckets with sub-millisecond latency on small files and full POSIX semantics. The pattern creates a VPC, S3 Files file system, mount targets, access point, and a Lambda function wired together.", |
There was a problem hiding this comment.
Applied suggested description, removed "(GA April 2026)". Fixed in f963437.
- Remove (GA April 2026) from README and example-pattern.json - Upgrade runtime to nodejs24.x via escape hatch - Update title to 'AWS Lambda with Amazon S3 Files Mount' - Use reviewer-suggested description text
|
Thanks for the quick review, @bfreiberg! All 4 comments addressed and pushed. Would appreciate another look when you get a chance |
New Serverless Pattern: Lambda with Amazon S3 Files Mount
Description
Deploys a Lambda function with an Amazon S3 Files file system mounted at
/mnt/s3data, enabling standard file operations (read, write, list) on S3 data without downloading objects. Uses Amazon S3 Files (GA April 2026).Architecture
Key Features
fsmoduleFramework / Language
Deployment & Testing
Files
lib/lambda-s3-files-stack.tssrc/index.jsexample-pattern.json