DEV Community

StuartCreed
StuartCreed

Posted on

List all of your buckets in Lambda

import {S3Client, ListBucketsCommand} from '@aws-sdk/client-s3';
const s3 = new S3Client({region: 'us-west-2'});

export const handler = async (event) => {
const data = await s3.send(new ListBucketsCommand({}));
return data.Buckets;
};

Top comments (0)