Installing and upgrading
Backups
Security
User management
Advanced user group options
Customising ResourceSpace
Plugins
StaticSync
Configuring ResourceSpace
Integrations

Mounting Amazon S3 for external storage

You can configure ResourceSpace to use an S3 bucket by mounting the bucket to your local filesystem. The instructions below are for Ubuntu/Debian.


Step 1: Mount the S3 Bucket

To mount your S3 bucket, you can use a tool such as s3fs. Follow these steps:

  1. Install s3fs Install the s3fs package on your server. On Ubuntu, for example, you can use the following command:

    sudo apt update
    sudo apt install s3fs
  2. Set Up Your S3 Credentials Create a credentials file to store your S3 access keys. For example:

    echo "AWS_ACCESS_KEY_ID:AWS_SECRET_ACCESS_KEY" > ~/.passwd-s3fs
    chmod 600 ~/.passwd-s3fs
  3. Mount the Bucket Use the s3fs command to mount your bucket. Replace your-bucket-name with your S3 bucket’s name and choose a local directory, such as /mnt/s3:

    mkdir -p /mnt/s3
    s3fs your-bucket-name /mnt/s3 -o allow_other -o use_cache=/tmp

    Ensure that the allow_other option is enabled to allow other system users (like the web server) to access the mounted bucket.

  4. Configure Automatic Mounting (Optional) Add an entry to your /etc/fstab file for persistent mounting on reboot. For example:

    s3fs#your-bucket-name /mnt/s3 fuse _netdev,allow_other,use_cache=/tmp 0 0

Step 2: Configure ResourceSpace

Once the S3 bucket is mounted, you can update ResourceSpace to use it as the storage directory.

  1. Open the config.php file in your ResourceSpace installation directory.

  2. Modify the $storagedir variable to point to the mounted S3 directory. For example:

    $storagedir = '/mnt/s3';
  3. Save the changes and restart your web server if necessary.


Step 3: Verify Permissions

Ensure that the web server user (e.g., www-data on Ubuntu) has read and write permissions for the mounted S3 directory:

sudo chown -R www-data:www-data /mnt/s3

Step 4: Test the Configuration

Upload and retrieve files within ResourceSpace to confirm that everything is working correctly. Files should be saved to and retrieved from the mounted S3 bucket.


Notes and Considerations

  • Performance: Using an S3 bucket as a mounted filesystem may introduce latency and performance overhead compared to local disk storage. Evaluate whether this setup meets your requirements.

  • Reliability: Ensure the network connection to your S3 bucket is stable to avoid interruptions in accessing your files.