5

I want to list the object URLs of all files in my public bucket. I read all the documents about s3 and s3api, but I couldn't find what I was looking for.

I don't want to define the pre-sign URL. I want to list the existing URLs of all files in the folder.

I'm sorry I couldn't add code, but I have a very specific problem and I can't find my starting point.

I'd appreciate it if someone help.

Solution: https://github.com/cagdasdemirer/AWS-S3-URL-Listing

1 Answers1

4

I don't think there's a direct way to get the URLs of all the S3 files in bucket. This is how can do it:

  1. List all the files in S3 using:

aws s3 ls s3://bucket-name/folder-name

  1. Build a URL like this:

http://s3.amazonaws.com/bucket/key (for path-style URL), or

http://bucket.s3.amazonaws.com/key (for virtual-hosted style URL)

  1. Store it in the folder.

This SO link may help you: https://stackoverflow.com/a/44401684/7541412

Let me know if it helped.

Thanks

Community
  • 1
  • 1
Hassan Murtaza
  • 963
  • 6
  • 15