Skip to content

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

Open
kasacis wants to merge 1 commit intoaws-samples:mainfrom
kasacis:kasacis-lambda-standard-s3-files
Open

New serverless pattern: Mount an S3 Bucket as a File System on AWS Lambda#3061
kasacis wants to merge 1 commit 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.

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.

4 participants