Tuesday 6 June 2017

How to get the URL of a file on AWS S3 using aws-sdk?

I'm using a AWS Lambda function to create a file and save it to my bucket on S3, it is working fine. After executing the putObject method, I get a data object, but it only contains an Etag of the recently added object.

s3.putObject(params, function(err, data) {
    //data only contains Etag
});

I need to know the exact URL that I can use in a browser so the client can see the file. The folder has been already made public and I can see the file if I copy the Link from the S3 console.

I tried using getSignedUrl but the URL it returns is used for other purposes, I believe.

Thanks!



via Pablo Quemé

No comments:

Post a Comment