列出来自公共访问的Amazon S3存储桶中的对象

发布于 2025-01-19 09:34:28 字数 105 浏览 2 评论 0原文

我有一个Amazon S3存储桶,该存储桶是公开列表并获得许可的。我想在Ruby中列出对象。我们可以使用AWS SDK列出对象,但需要凭据。我想在不使用凭据的情况下列出Ruby中的对象。如何实现?

I have one Amazon S3 bucket which is public with list and get permission. I want to list object in ruby. We can use AWS SDK to list objects but it require credentials. I want to list objects in ruby without using credentials. how to achieve this ??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

花期渐远 2025-01-26 09:34:28

我认为您可以使用HTTP方法。AmazonS3支持通过使用REST API向Amazon S3端点提出请求。
我尝试使用http方法的putobject,并且它可以使用,我使用curl命令。
但是对象所有者是匿名的,我无法将其删除。
而且我不熟悉Ruby,我认为它也可以与ListObject一起使用,而无需使用SDK。

这是我的卷曲命令:
curl - request put -upload-file“ ./myobject”“” https:// $ {mybkt} ......../myObject“ listObject”

listObject http http方法文档:
https://docs.aws.aws.aws.aws.amazon.com/amazons.com/amazons.com/amazons3/latest/ api/api_listObjectsv2.html

I think you could use the HTTP Method.Amazon S3 support make requests to Amazon S3 endpoints by using the REST API.
I try putObject with HTTP Method and it work,I use the curl command.
But the Object owner is anonymous, i can't remove it.
And I am not familiar with Ruby,I think it also work with listObject without use SDK.

This is my curl command :
curl --request PUT --upload-file "./myobject" "https://${mybkt}......../myobject"

ListObject HTTP method Doc:
https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html

萝莉病 2025-01-26 09:34:28

要以任何语言使用AWS SDK,您需要以该给定语言创建服务客户端,Ruby 与 .NET、Python、Java 等没有什么不同

。来自服务客户端(不是 CLI 或 Rest 等)的 AWS 服务调用,您必须指定凭据。更多信息可在 AWS Ruby 开发指南中找到:

配置适用于 Ruby 的 AWS 开发工具包

To use AWS SDK in any language, you need to create a Service Client in that given language, Ruby is no different from .NET, Python, Java, etc.

To make an AWS Service call from a Service Client (not CLI, or Rest, etc), you must specify creds. More information can be found in the AWS Ruby DEV Guide:

Configuring the AWS SDK for Ruby

情栀口红 2025-01-26 09:34:28

并非所有AWS SDK都会揭示发出未签名API请求的选项。 Ruby SDK中没有选择。

您可能需要评论或重新打开,此前已关闭的 在Ruby SDK中。

Not all AWS SDKs expose options to make unsigned API requests. There is no option in the Ruby SDK.

You might want to comment on, or re-open, this previously-closed feature request in the Ruby SDK.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文