简体   繁体   English

阻止某个 aws s3 Bucket 请求

[英]Block a certain aws s3 Bucket request

I want to have access to the files which are in my s3 buket.我想访问我的 s3 buket 中的文件。 However this should only work if I have the link + filename.但是,这只有在我有链接+文件名的情况下才有效。 Currently I can list all files in my buket with the "s3.listObjects" method.目前,我可以使用“s3.listObjects”方法列出我的 buket 中的所有文件。

Is it possible to block this certain request?是否可以阻止此特定请求?

AWS.config.region = 'location';
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
    IdentityPoolId: 'location:xxxxxxxxxx',
});
var s3 = new AWS.S3({
    apiVersion: '2006-03-01',
    params: { Bucket: "buketname" }
});

function listBucketFiles() {
    s3.listObjects({ Delimiter: '/' }, function (err, data) {
        if (err) {
            return alert('There was an error listing your albums: ' + err.message);
        } else {
            console.log(data);

        }
    });
}

You can block the s3:listObjects action by either removing it (or adding explicit Deny ) in the IAM user policies in your AWS account, or by adding a Deny in the S3 bucket policy .您可以阻止s3:listObjects操作,方法是在您的 AWS 账户的IAM 用户策略中将其删除(或添加显式Deny ),或者在S3 存储桶策略中添加Deny

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM