Home > database >  List objects from publicly accessible Amazon S3 bucket
List objects from publicly accessible Amazon S3 bucket

Time:04-07

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

CodePudding user response:

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, you must specify creds. There is no getting around that. It's required when using the AWS SDK.

More information can be found in the AWS Ruby DEV Guide:

Configuring the AWS SDK for Ruby

CodePudding user response:

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

  • Related