是否可以使用 Amazon S3 为选择性用户共享文件
我的 S3 存储桶中的文件很少。是否可以与选定的用户共享它们。这些人可能没有 Amazon S3 帐户。我知道如果我将其公开,每个人都可以使用 URL 下载文件。
我想要一个加密的 URL 或一个在被点击时立即要求输入用户名和密码的 URL。
而且我也不想安装任何新的/第三方软件供每个人安装。
谢谢
I have few files in my S3 bucket. Is it possible to share them with selected users. Those people might not have Amazon S3 account. I know if i make it public everyone could able to download the files using URL.
I want something like an encrypted URL or an URL that asks for some Username and password immediately when it is been hit.
And also i do not want to install any new/ third party softwares to be installed by everyone.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
绝对地。
您可以将文件设为 私有,然后生成 < a href="http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?S3_QSAuth.html" rel="nofollow noreferrer">签名时间到期url 到您的文件。
签名的 URL 是使用您的公钥和密钥生成的,并且设置为在将来的指定时间过期。
根据您使用的技术,使用 AWS 开发工具包。
签名网址看起来像:
我在这个答案。
Absolutely.
You can make your files private and then generate time expiring signed urls to your files.
The signed urls are generated using your public key and secret key and are set to expire at a specified time in the future.
Depending on what technology you are using, its probably easiest to generate the urls using one of the AWS SDKS.
Signed urls look something like:
I explain a bit more about these urls in this answer.
下面是一个示例 ruby 代码,用于为存储桶中的特定位置生成签名 URL。
安装
aws-sdk
:创建一个新文件,根据需要命名,我选择
shareS3files.rb
,请在gist.github.com:现在,创建凭据和配置文件:
secrets.json
:config.json
:进一步的aws和ruby文档:
Here is a sample ruby code to generate signed urls for a particular location in your bucket.
Install
aws-sdk
:Create a new file, name it as you want, I choose
shareS3files.rb
see it on gist.github.com:Now, create both credential and configuration files:
secrets.json
:config.json
:Further aws and ruby doc:
如果您安装了 AWS CLI,则只需使用 presign。
您还可以将链接设置为在 24 小时内过期
86400 = (60 * 60 * 24))
If you have the AWS CLI installed you can simply use presign.
You can also set the link to expire in 24hrs
86400 = (60 * 60 * 24))