Last active
February 12, 2023 19:01
-
-
Save flexicious/e836c8d5fa06d713e8770b25aee06b65 to your computer and use it in GitHub Desktop.
Make a signed S3 Url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
S3Client, | |
PutObjectCommand } | |
from "@aws-sdk/client-s3"; | |
import {getSignedUrl} from "@aws-sdk/s3-request-presigner"; | |
const signS3URL = async () => { | |
const s3Params = { | |
Bucket: "your-bucket", | |
Key: "config.json", | |
}; | |
const s3 = new S3Client({}) | |
const command = new PutObjectCommand(s3Params); | |
try { | |
const signedUrl = await getSignedUrl(s3, command, { expiresIn: 300 }); | |
console.log(signedUrl); | |
} catch (err) { | |
console.error(err); | |
} | |
} | |
signS3URL(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment