0

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

smac2020
  • 9,637
  • 4
  • 24
  • 38
Akshay Gopani
  • 473
  • 4
  • 16

3 Answers3

0

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

smac2020
  • 9,637
  • 4
  • 24
  • 38
  • 1
    Actually, `boto3` has the ability to make an unsigned API call, which enables the AWS CLI to use `--no-sign-request`, so AWS credentials are not required. See: [Equivalent of aws s3 cp with --no-sign-request for boto3.client() ? · Issue #1200 · boto/boto3 · GitHub](https://github.com/boto/boto3/issues/1200) – John Rotenstein Apr 06 '22 at 23:23
0

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

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.

jarmod
  • 71,565
  • 16
  • 115
  • 122