通过Url从Amazon S3获取文件 [英] Url to get a file from Amazon S3

查看:1617
本文介绍了通过Url从Amazon S3获取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在计算如何从Amazon S3访问文件时遇到了一些麻烦。假设文件所在的存储桶是BUCKET_NAME,文件是FILE_NAME等。我尝试了以下两个网址:

  https://s3.amazonaws.com/BUCKET_NAME/FILE_NAME/ 
?Expires = EXPIRATION
& Signature = SIGNATURE
& SignatureVersion = 2
& SignatureMethod = HmacSHA1
& AWSAccessKeyId = KEYID

但是这给了我以下错误:
NoSuchKey
指定的键不存在。



我也试过

  https://s3.amazonaws.com/BUCKET_NAME/ 
?Key = FILE_NAME
& Expires = EXPIRATION
& Signature = SIGNATURE
& SignatureVersion = 2
& SignatureMethod = HmacSHA1
& AWSAccessKeyId = KEYID

但是这会返回一个包含给定存储区(包括FILE_NAME)中所有文件列表的网页,而不是我想要的特定文件。我也尝试将Action = GetObject投入到网址中,但这似乎没有改变任何内容。

找出哪个(如果有的话)是正确的方法以及我做错了什么会有帮助。我一直在挖掘亚马逊文档一段时间,但我似乎无法排除它。



谢谢。



  https://< p>斗名称> .s3.amazonaws.com /<键> 

请参阅这里


I am having some trouble figuring out how to access a file from Amazon S3. Lets say that the bucket that the file lives in is BUCKET_NAME, the file is FILE_NAME, etc. I have tried the following two urls:

https://s3.amazonaws.com/BUCKET_NAME/FILE_NAME/
?Expires=EXPIRATION
&Signature=SIGNATURE
&SignatureVersion=2
&SignatureMethod=HmacSHA1
&AWSAccessKeyId=KEYID

But this gives me the following error: NoSuchKey The specified key does not exist.

and I have also tried

https://s3.amazonaws.com/BUCKET_NAME/
?Key=FILE_NAME
&Expires=EXPIRATION
&Signature=SIGNATURE
&SignatureVersion=2
&SignatureMethod=HmacSHA1
&AWSAccessKeyId=KEYID

but this returns a webpage with a list of all of the files in the given bucket (including FILE_NAME), instead of the specific file I want. I have also tried throwing in "Action=GetObject" into the url as well but that doesn't seem to change anything.

It would be helpful to find out which (if any) is the proper method and what I am doing wrong. I have been digging through amazon documentation for a while now but I can't seem to sort it out.

Thanks.

解决方案

Its actually formulated more like:

https://<bucket-name>.s3.amazonaws.com/<key>

See here

这篇关于通过Url从Amazon S3获取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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