I am trying to upload a file to the S3 bucket, it gives an Access Denied error. I use multer-s3 .

 const s3 = new aws.S3({ secretAccessKey: process.env.AWS_ACCESS_KEY, accessKeyId: process.env.AWS_KEY_ID, region: process.env.AWS_REGION, }); const upload = multer({ storage: multerS3({ s3, bucket: 'my-bucket-name', dirname: '/images', acl: 'public-read', metadata: function (req, file, cb) { cb(null, { fieldName: file.fieldname }); }, key: function (req, file, cb) { cb(null, Date.now().toString()); }, }), }); 

In AWS for the user policy is set, but still an error:

 { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "s3:*", "Resource": "*" } ] } 

    0