AWS Lambda using Amazon S3 Files

AWS Lambda → Amazon S3 Files

This pattern mounts an Amazon S3 bucket as a file system on AWS Lambda using Amazon S3 Files. Read data with standard Python file I/O.

Amazon S3 Files is a shared file system built on Amazon EFS that provides full POSIX file system semantics over your S3 data. It lets file-based applications, agents, and tools work directly with S3 data without duplicating it or learning new APIs.
This pattern links an S3 bucket to an S3 file system and mounts it on a Lambda function at /mnt/s3data. When invoked, the Lambda function reads a CSV file from the mount path — all through standard Python file I/O, with no boto3 S3 calls.
This pattern deploys one Amazon S3 bucket, one Amazon S3 file system, one mount target, one Amazon S3 Files access point, one AWS Lambda function, and a VPC with a private subnet and VPC endpoints for Amazon S3.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/lambda-s3-files-sam

Deploy

sam buildsam deploy --guided


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: aws cloudformation delete-stack --stack-name STACK_NAME.

Created by:

Serda Kasaci Yildirim

Serda Kasaci Yildirim

Serda is a Solutions Architect at Amazon Web Services (AWS) based in Vienna, Austria.

Follow on LinkedIn