问题
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