S3 - Anonymous Upload - Key prefix

前端 未结 2 1553
鱼传尺愫
鱼传尺愫 2021-02-01 07:06

I am trying to understand exactly how to setup a bucket that is generally private but allows anonymous uploads with restrictions. The specific criteria are:

  • The bu
2条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-01 07:27

    What you describe can be implemented within one bucket. You can allow anonymous access to specific folder via bucket policy, check examples or use AWS Policy Generator. In your case it could look something like this:

    {
        "Version": "2008-10-17",
        "Id": "Policy1346097257207",
        "Statement": [
            {
                "Sid": "Allow anonymous upload to /incoming",
                "Effect": "Allow",
                "Principal": {
                    "AWS": "*"
                },
                "Action": "s3:PutObject",
                "Resource": "arn:aws:s3:::[your_bucket]/incoming/*"
            }
        ]
    }
    

    It is also possible to upload files to your bucket anonymously using a simple html form:

    Name:
    File:

    S3 browser based uploads are described here in detail.

提交回复
热议问题