getSignedUrl()
Keyはディレクトリも含めたファイル名
getObject
putObject
code:ts
import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
import {
getSignedUrl,
S3RequestPresigner,
} from "@aws-sdk/s3-request-presigner";
const createPresignedUrlWithClient = ({ region, bucket, key }) => {
const client = new S3Client({ region });
const command = new PutObjectCommand({ Bucket: bucket, Key: key });
return getSignedUrl(client, command, { expiresIn: 3600 });
};