In my app, users are able to upload images to their folder in an S3 bucket. Current requests in relation to uploading and retrieving images from S3 are handled through API Gateway, users are authenticated with Cognito.
Is there a way where I could list all objects in a folder of a bucket and be able to display all of the images?
I'm asking the same question as this one, except I only want authenticated users to be able to access it.
Is there a way I could retrieve them through a Lambda function?
Any help appreciated.
Update
I have tried to implement S3's listObjectsV2
function which does not return resigned URLs with each object. Is there a way to achieve this?
Response from function:
{
"IsTruncated": false,
"Contents": [
{
"Key": "username/image/Screenshot 2021-02-22 at 13.24.55.png",
"LastModified": "2021-03-07T19:43:05.000Z",
"ETag",
"Size": 22436,
"StorageClass": "STANDARD"
}
],
"Name": "user-images",
"Prefix": "username/",
"MaxKeys": 1000,
"CommonPrefixes": [],
"KeyCount": 1
}