How can i enforce file type uploads with an AWS S3 bucket policy

冷暖自知 提交于 2020-01-04 07:54:42

问题


Using a bucket policy for AWS S3, is it possible to enforce that the file being uploaded (PutObject) has the file extension ".txt"? If so what would that bucket policy look like?


回答1:


Something like this:

{
  "Version":"2008-10-17",
  "Statement": [
    {
      "Sid":"AddPerm",
      "Effect":"Allow",
      "Principal": { "AWS": "arn:aws:iam::111122223333:root" },
      "Action": "s3:PutObject",
      "Resource": "arn:aws:s3:::bucket/*.txt"
    }
  ]
}


来源:https://stackoverflow.com/questions/17050308/how-can-i-enforce-file-type-uploads-with-an-aws-s3-bucket-policy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!