Was this content helpful?
How could we make this article more helpful?
Apostrophe CMS can be used with Lyve Cloud.
npm install @aws-sdk/client-s3
where:
require('dotenv').config();
const AWS = require('aws-sdk');
// Configure AWS credentials and region
AWS.config.update({
accessKeyId: process.env.LC_ACCESS_KEY_ID,
secretAccessKey: process.env.LC_SECRET_ACCESS_KEY,
region: process.env.LC_REGION,
endpoint: process.env.LC_ENDPOINT
});
const s3 = new AWS.S3();
// List objects in a specific S3 bucket
s3.listObjectsV2({ Bucket: process.env.LC_BUCKET_NAME }, (err, data) => {
if (err) {
console.error('Error listing objects:', err);
} else {
const objects = data.Contents;
console.log(objects);
}
});
[
{
Key: 'Pic-1.png',
LastModified: 2024-11-05T12:17:38.261Z,
ETag: '"651b690ab5db93496d9ca412e8d7823a"',
ChecksumAlgorithm: [],
Size: 1121955,
StorageClass: 'STANDARD'
},
{
Key: 'Pic-2.png',
LastModified: 2024-11-05T12:17:28.824Z,
ETag: '"03685db85f0533211f4f865768e0100d"',
ChecksumAlgorithm: [],
Size: 479053,
StorageClass: 'STANDARD'
},
{
Key: 'Pic-3.png',
LastModified: 2024-11-05T12:17:33.578Z,
ETag: '"7b71081d8b7b21d6ee712692cc0d335e"',
ChecksumAlgorithm: [],
Size: 645935,
StorageClass: 'STANDARD'
}
]