SDK – Node.js (AWS SDK v3)
Interact with Aurora using the AWS SDK for JavaScript v3.
Select S3 Endpoint
Choose preferred region.
Install
npm i @aws-sdk/client-s3
Configure client
import { S3Client, ListBucketsCommand, PutObjectCommand, GetObjectCommand } from "@aws-sdk/client-s3";
const s3 = new S3Client({
endpoint: "https://",
region: "us-east-1",
credentials: {
accessKeyId: process.env.AURORA_ACCESS_KEY!,
secretAccessKey: process.env.AURORA_SECRET_KEY!,
},
forcePathStyle: true,
});
async function main() {
const buckets = await s3.send(new ListBucketsCommand({}));
console.log(buckets.Buckets);
await s3.send(new PutObjectCommand({
Bucket: "my-bucket",
Key: "file.txt",
Body: Buffer.from("hello"),
}));
}
main().catch(console.error);