如何设置URL格式以从Amazon S3获取文件?

编程入门 行业动态 更新时间:2024-10-14 14:21:29
本文介绍了如何设置URL格式以从Amazon S3获取文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在弄清楚如何从Amazon S3访问文件时遇到了一些麻烦.可以说文件所在的存储区是BUCKET_NAME,文件是FILE_NAME,依此类推.我尝试了以下两个URL:

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:

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

但这给了我以下错误:

<Code>NoSuchKey</Code> <Message>The specified key does not exist.</Message>

我也尝试过:

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

,但这会返回一个网页,其中包含给定存储桶(包括FILE_NAME)中所有文件的列表,而不是我想要的特定文件.我也尝试将Action=GetObject放入URL中,但这似乎并没有改变.

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's documentation for a while now but I can't seem to sort it out.

推荐答案

其实际上更像是:

<bucket-name>.s3.amazonaws/<key>

请参见此处

更多推荐

如何设置URL格式以从Amazon S3获取文件?

本文发布于:2023-11-23 16:38:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1622156.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何设置   格式   文件   URL   Amazon

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!