Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

AWS client-s3 getSignedUrl equivalent

My client are currently getting access to some objects with getSignedUrlPromise from the package aws-sdk. The request are done from the backend and the signed url is returned to the client, everything is fine.

I’m now trying to migrate from aws-sdk to @aws-sdk/client-s3. I’d like to keep to same structure, but i can’t find such command in the documentation.

I’m pretty sure @aws-sdk/client-s3 is capable of returning a signed url

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Are there any (non – hacky) ways to do it ?

EDIT: Relying on this, i should use @aws-sdk/s3-request-presigner on top of @aws-sdk/client-s3 to get presigned urls.

>Solution :

You can use @aws-sdk/s3-request-presigner. For example:

const { getSignedUrl } = require("@aws-sdk/s3-request-presigner");
const { S3Client, GetObjectCommand } = require("@aws-sdk/client-s3");
// ...
const client = new S3Client(clientParams);
const command = new GetObjectCommand(getObjectParams);
const url = await getSignedUrl(client, command, { expiresIn: 3600 });
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading