I need to get list of objects from my AWS s3 bucket. I try:
const s3 = new AWS.S3();
const params = {
Bucket: "arn:aws:s3:::test-bucket-n-i",
MaxKeys: 10
};
s3.listObjectsV2(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
This Arn I copied form my test bucket. As result I get:
InvalidARN: ARN accountID does not match regex "[0-9]{12}"
How can it be invalid? How can I call s3.listObjectsV2 without creating an Access point?