The other day, I worked on mounting EC2 and S3.
I was able to mount it by referring to the above URL, but I suddenly wondered.
I want to put the file in S3 because I do not want to eat the storage of EC2 with the uploaded file, but if I mount it with S3 and EC2, I also use the storage of EC2 (because I will put the file in the directory in EC2) Will it be?
I'm sorry if I said something I didn't understand. Thank you.

  • Answer # 1

    If I mount it on S3 and EC2, will I also use the EC2 storage (because I will put the files in the directory inside EC2)?

    It will not be.

  • Answer # 2

    If S3 is mounted, reading and writing to the mount point (directory) will be performed on S3. Reading and writing to other than the mount point is done to the EC2 storage.

    Please test it.

    Create a mount point and create a file

    $mkdir ~/mount-goofys
    $touch ~/mount-goofys/test-ec2 #Create file
    $ls ~/mount-goofys
    test-ec2 ← The created file is displayed

    Mount and check the contents

    $./go/bin/goofys kohei-goofys ~/mount-goofys
    $touch test-s3 # file creation
    $ls ~/mount-goofys
    test-s3 ← I can't see the file before mounting

    Unmount and check the contents

    $umount ~/mount-goofys
    $ls ~/mount-goofys
    test-ec2 ← You cannot see the file being mounted, you can see the file before mounting