Skip to content

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

@kasacis

Description

@kasacis

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

all other additional information exist in README.md and example-pattern.json.

GitHub PR for template: #3061

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions