Awesome Open Source
Awesome Open Source

s3monkey: Access your S3 buckets like they're native files

Platforms like Heroku <>_ don't allow for FUSE filesystem usage, so I had to get a bit creative.

Introducing, s3monkey, a library that mocks out all standard Python library system file operations, allowing you to use already–written code to interface with Amazon S3.

All standard library file operation modules are patched when using the provided context manager, including the built–in open, os, io, & pathlib.

If you're interested in financially supporting Kenneth Reitz open source, consider visiting this link <$KennethReitz>_. Your support helps tremendously with sustainability of motivation, as Open Source is no longer part of my day job.

Potential Use Cases

  • Running Jupyter Notebooks on non-persistient storage (still being worked out).
  • Storing user uploads for Django applications (e.g. the media folder).


AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are expected to be set:

.. code-block:: shell

$ AWS_ACCESS_KEY_ID=xxxxxxxxxxx

Basic usage:

.. code-block:: python

from s3monkey import S3FS

with S3FS(bucket='', mount_point='/app/data') as fs:

    # Create a 'test' key on S3, with the contents of 'hello'.
    with open('/app/data/test', 'w') as f:

    # List the keys in the S3 bucket.
    # ['file1.txt', 'file2.txt', 'file2.txt', 'test', …]


.. code-block:: shell

$ pipenv install s3monkey

This module only supports Python 3.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
python (50,901
s3 (191
mock (168
fuse (73
fs (29

Find Open Source By Browsing 7,000 Topics Across 59 Categories