Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Amazon S3 support symlinks?

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?

like image 770
The user with no hat Avatar asked Apr 05 '15 17:04

The user with no hat


People also ask

Can S3 be used as key value store?

S3 provides tools for uploading large objects in parts and migrating big data into storage. AWS S3 is a key-value store, one of the major categories of NoSQL databases used for accumulating voluminous, mutating, unstructured, or semistructured data.

What protocols does S3 support?

s3 Protocol Proxy Support You can specify a URL that is the proxy that S3 uses to connect to a data source. S3 supports these protocols: HTTP and HTTPS.

Does S3 support byte range?

Amazon S3 doesn't have any limits for the number of connections made to your bucket. Typical sizes for byte-range requests are 8 MB or 16 MB. If objects are PUT using a multipart upload, it's a good practice to GET them in the same part sizes (or at least aligned to part boundaries) for best performance.

How do I get the Uri on my Galaxy S3?

Get an S3 Object's URL #Navigate to the AWS S3 console and click on your bucket's name. Use the search input to find the object if necessary. Click on the checkbox next to the object's name. Click on the Copy URL button.


2 Answers

S3 does not support the notion of a symlink, where one object key is treated as an alias for a different object key. (You've probably heard this before: S3 is not a filesystem. It's an object store).

If you are using the static web site hosting feature, there is a partial emulation of this capability, with object-level redirects:

http://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html

This causes requests for "object-a" to be greeted with a 301 Moved Permanently response, with the URL for "object-b" in the Location: header, which serves a similar purpose, but is of course still quite different. It only works if the request arrives at the website endpoint (not the REST endpoint).

If you use a reverse proxy (haproxy, nginx, etc.) in EC2 to handle incoming requests and forward them to the bucket, then of course you have the option at the proxy layer of rewriting the request URL before forwarding to S3, so you could translate the incoming request path to whatever you needed to present to S3. How practical this is depends on your application and motivation, but this is one of the strategies I use to modify where, in a particular bucket, an object appears, compared to where it is actually stored, allowing me to rewrite paths based on other attributes in the request.

like image 112
Michael - sqlbot Avatar answered Oct 01 '22 15:10

Michael - sqlbot


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.

like image 23
cdoughty Avatar answered Oct 01 '22 14:10

cdoughty