getSignedUrl()
docs
BucketはS3 Bucketの名前
Keyはディレクトリも含めたファイル名
https://docs.aws.amazon.com/ja_jp/AmazonS3/latest/userguide/object-keys.html
getObject
putObject
https://docs.aws.amazon.com/ja_jp/AmazonS3/latest/userguide/example_s3_Scenario_PresignedUrl_section.html
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 });
};