Skip to content

Instantly share code, notes, and snippets.

@tomsing1
Created July 14, 2020 16:18
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomsing1/8ea0169f7a47224accc3ae18ca14e951 to your computer and use it in GitHub Desktop.
Save tomsing1/8ea0169f7a47224accc3ae18ca14e951 to your computer and use it in GitHub Desktop.
Mounting an S3 bucket as a folder on Mac OS X

This document shows how to mount an AWS S3 bucket on Mac OS X using goofyfs.

The first three steps illustrate how to use goofys

  1. Install goofyfs via brew
brew cask install osxfuse
brew install goofys
  1. Create an empty directory as a mount point for the S3 bucket
mkdir -p ~/drat
  1. Mount a prefix of an S3 bucket (note the colon)
goofys com-dnli-ngs-test:drat ~/drat
  1. When you are done, unmount the bucket
umount ~/drat
ls ~/drat  # empty

The following steps are only included to highlight the functionality of goofys:

  1. Verify that files are sync'ed to S3
echo "Test" > ~/drat/test.tmp
aws s3 cp s3://com-dnli-ngs-test/drat/test.tmp -

echo "Test 2" > ~/drat/test.tmp
aws s3 cp s3://com-dnli-ngs-test/drat/test.tmp -
  1. Unmount the bucket - and the local directory is empty
umount ~/drat
ls ~/drat  # empty
aws s3 ls s3://com-dnli-ngs-test/drat/  # not empty
  1. Re-mount the bucket - and the files are back
goofys com-dnli-ngs-test:drat ~/drat
ls ~/drat  # not empty
  1. Remove local files - and they are also removed from S3
rm ~/drat/test.tmp
aws s3 ls s3://com-dnli-ngs-test/drat/  # empty
  1. Unmount the bucket when you are done
umount ~/drat
ls ~/drat  # empty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment