Point symlink to external URL

Solution 1:

There is no way to create a symlink to a non-mounted filesystem.

A S3 bucket can be mounted as a local filesystem using s3fs, see https://github.com/s3fs-fuse/s3fs-fuse. Once you do this, it appears as a local filesysem and you could symlink in the normal way.

Note that behind the scenes this is using the S3 API to fetch content to your local server and delivering it from there. Relatively speaking, it is slow. This may make it unsuitable for your web site, but that determination is up to you.

An alternative method that you may wish to consider is to redirect the requests using Apache's RewriteRule functionality. Using a regular expression this is fairly trivial,

RewriteRule ^/assets/(.*)$ https://my-amazon-s3.com/assets/$1 [R=302,L]

If you're using HAProxy then you could achieve a similar result with that.