Skip to content

New serverless pattern: Mount an Amazon S3 Bucket as a File System on AWS Lambda using Amazon S3 Files#3061

Open
kasacis wants to merge 14 commits intoaws-samples:mainfrom
kasacis:kasacis-lambda-standard-s3-files
Open

New serverless pattern: Mount an Amazon S3 Bucket as a File System on AWS Lambda using Amazon S3 Files#3061
kasacis wants to merge 14 commits intoaws-samples:mainfrom
kasacis:kasacis-lambda-standard-s3-files

Conversation

@kasacis
Copy link
Copy Markdown

@kasacis kasacis commented Apr 17, 2026

New Pattern: Mount Amazon S3 Files on AWS Lambda

*Issue #, if available: #3062

Description of changes:

This pattern demonstrates how to mount an Amazon S3 bucket as a file system on an AWS Lambda function using Amazon S3 Files, enabling standard Python file I/O to read S3 data — no S3 SDK calls required.

What's included

  • SAM template deploying Lambda, S3 Files file system, mount target, access point, S3 bucket, VPC with private subnet and VPC endpoints (no NAT Gateway)
  • Python Lambda handler using pandas to read CSV files via the S3 Files mount at /mnt/s3data
  • pandas Lambda layer (Linux x86_64 compatible)
  • Unit tests (pytest, no AWS required)
  • Sample CSV for integration testing
  • Architecture diagram
  • Full README with build, deploy, test, and cleanup instructions

Key design decisions

  • Uses VPC endpoints (S3 Gateway + S3 Files Interface) instead of NAT Gateway — cheaper and more secure
  • pandas layer built with --platform manylinux2014_x86_64 for cross-platform compatibility
  • Access point scoped to /lambda root directory

Testing

  • Unit tests: pytest src/tests/ -v — 10/10 passing
  • Integration tested against a deployed stack in us-east-1

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Comment thread s3files-lambda-sam/README.md Outdated
Comment thread s3files-lambda-sam/README.md Outdated
Comment thread s3files-lambda-sam/README.md Outdated
Comment thread s3files-lambda-sam/template.yaml Outdated
Comment thread s3files-lambda-sam/template.yaml Outdated
Comment thread s3files-lambda-sam/example-pattern.json Outdated
Comment thread s3files-lambda-sam/example-pattern.json Outdated
Comment thread s3files-lambda-sam/example-pattern.json Outdated
kasacis and others added 5 commits April 27, 2026 22:02
Co-authored-by: Ben <9841563+bfreiberg@users.noreply.github.com>
Co-authored-by: Ben <9841563+bfreiberg@users.noreply.github.com>
Co-authored-by: Ben <9841563+bfreiberg@users.noreply.github.com>
Co-authored-by: Ben <9841563+bfreiberg@users.noreply.github.com>
Co-authored-by: Ben <9841563+bfreiberg@users.noreply.github.com>
@kasacis kasacis requested a review from bfreiberg April 27, 2026 20:10
@kasacis kasacis changed the title New serverless pattern: Mount an S3 Bucket as a File System on AWS Lambda New serverless pattern: Mount an Amazon S3 Bucket as a File System on AWS Lambda using Amazon S3 Files Apr 27, 2026
@bfreiberg
Copy link
Copy Markdown
Contributor

Can you please rename the folder to lambda-s3-files-sam and reduce the description to be within 175 characters

@kasacis
Copy link
Copy Markdown
Author

kasacis commented Apr 29, 2026

fixed,

  • renamed as lambda-s3-files-sam
  • description is less than 175 chars

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants