Skip to content

Instantly share code, notes, and snippets.

@korakot
Created October 21, 2019 02:52
Show Gist options
  • Save korakot/e28ea5269129b70f220fe5e8d065b446 to your computer and use it in GitHub Desktop.
Save korakot/e28ea5269129b70f220fe5e8d065b446 to your computer and use it in GitHub Desktop.

First, get your access and secret key from here

Then embed it in the colab notebook.

%%writefile ~/.passwd-s3fs
AWS_ACCESS_KEY_ID:AWS_SECRET_ACCESS_KEY

Need to restrict access

!chmod 600 ~/.passwd-s3fs

Then install S3 file system.

!apt install s3fs

Choose local path(/s3), and mount the bucket name (here it's thainlp)

!mkdir /s3         
!s3fs thainlp /s3

Now you can access S3 bucket as a directory

!ls /s3
@shrawansapre
Copy link

Hey, loved this solution. Thank you!
Q - Does an S3 bucket unmount at runtime too (like uploaded files and mounted Drive)?

@nischal-sanil
Copy link

nischal-sanil commented Jun 14, 2021

To unmount just use: umount /s3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment