List objects from publicly accessible Amazon S3 bucket

723 views Asked by At

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 ??

3

There are 3 answers

0
Charles Lu On

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

0
jarmod On

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.

1
smac2020 On

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