Amazon S3是否支持符号链接? [英] Does Amazon S3 support symlinks?

查看:203
本文介绍了Amazon S3是否支持符号链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个对象,我想使用不同的键来解决这个问题,而无需实际复制对象本身,例如Linux中的符号链接.亚马逊S3提供了这种东西吗?

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?

推荐答案

S3不支持符号链接的概念,在该符号链接中,一个对象键被视为另一对象键的别名. (您以前可能已经听说过:S3不是文件系统.它是对象存储库.)

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

这将导致对对象-a"的请求以301 Moved Permanently响应进行响应,并且在Location:标头中具有对象-b"的URL,这具有相似的目的,但当然仍然相当不同的.仅当请求到达网站端点(而不是REST端点)时,它才起作用.

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).

如果您在EC2中使用反向代理(haproxy,nginx等)来处理传入请求并将其转发到存储桶,那么当然可以在代理层选择在转发到S3之前重写请求URL ,因此您可以将传入的请求路径转换为需要呈现给S3的任何内容.这的实用性取决于您的应用程序和动机,但这是我用来修改对象在特定存储桶中出现的位置(与实际存储位置相比)的策略之一,使我可以根据其他属性来重写路径在请求中.

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.

这篇关于Amazon S3是否支持符号链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆