AWS S3
With this integration you can store and access data into amazon S3 buckets.

Official Websitehttps://aws.amazon.com/s3
NodeJS packagehttps://www.npmjs.com/package/@aws-sdk/client-s3
Version3.204.0
TagsBuckets, Files, Saas
Credential configuration
To fill the form params you need the Access key id
and the Secret access key
of the Programatic access
user you want to use. This user needs the permissions
to have access to S3 to work properly. If you need to create the user,
you can see how to do it here.
In the extra options field you can pass any of the params you can find here.
Here you have an example of a filled credential configuration form in YepCode:

AWS S3 snippets available in YepCode editor
note
The title is the triggering text for YepCode to autocomplete the script
Integration
New integration from credential
const awsS3Client = yepcode.integration.awsS3("credential-slug");
New integration from plain authentication data
const { S3Client } = require("@aws-sdk/client-s3");
const awsS3Client = new S3Client({
credentials: {
accessKeyId: "accessKeyId",
secretAccessKey: "secretAccessKey",
},
});
List buckets
List buckets
const { ListBucketsCommand } = require("@aws-sdk/client-s3");
const listBucketsCommand = new ListBucketsCommand({})
const listBucketsResult = await awsS3Client.send(listBucketsCommand);
listBucketsResult.Buckets.forEach(console.log)
Create a bucket
Create a bucket
const { CreateBucketCommand } = require("@aws-sdk/client-s3");
const createBucketCommand = new CreateBucketCommand({ Bucket: "bucket-name" });
awsS3Client.send(createBucketCommand).then(console.log).catch(console.error);
Delete a bucket
Delete a bucket
const { DeleteBucketCommand } = require("@aws-sdk/client-s3");
const deleteBucketCommand = new DeleteBucketCommand({ Bucket: "bucket-name" });
awsS3Client.send(deleteBucketCommand).then(console.log).catch(console.error);
Get file content
Get file content
const { GetObjectCommand } = require("@aws-sdk/client-s3");
const getObjectCommand = new GetObjectCommand({
Bucket: "bucket-name",
Key: "object-name",
});
const getObjectResult = await awsS3Client.send(getObjectCommand);
// Result.Body is a stream of object content
getObjectResult.Body.on("data", (data) => console.log(data.toString("utf8")));
Upload file
Upload file
const { PutObjectCommand } = require("@aws-sdk/client-s3");
const putObjectCommand = new PutObjectCommand({
Body: "Some string body, or stream with defined length",
Bucket: "bucket-name",
Key: "object-name",
});
awsS3Client.send(putObjectCommand).then(console.log).catch(console.error);
Upload file with stream
Upload file with stream
const { Upload } = require("@aws-sdk/lib-storage");
const upload = new Upload({
client: awsS3Client,
params: {
Bucket: "bucket-name",
Key: "object-name",
Body: readableStream,
},
});
upload.done().then(console.log).catch(console.error);