Does Amazon S3 support symlinks?

前端 未结 3 800
说谎
说谎 2020-12-29 19:14

I have an object which I would like to address using different keys without actually copying the object itself, like a symlink in Linux. Does Amazon S3 provide such a thing?

3条回答
  •  没有蜡笔的小新
    2020-12-29 20:04

    I had a similar question and needed a solution, which I describe below. While S3 does not support symlinks, you can do this in a way with the following:

    echo "https://s3.amazonaws.com/my.bucket.name/path/to/a/targetfile" > file
    aws s3 cp file s3://my.bucket.name/file
    wget $(curl https://s3.amazonaws.com/my.bucket.name/file)
    

    What this is actually doing is getting the contents of the file, which is really just a pointer to the target file, then passing that to wget (curl can also be used to redirect to a file instead of wget).

    This is really just a work around though as its not a true symlink but rather a creative solution to simulate symlinks.

提交回复
热议问题