403 forbidden error on S3 REST API HEAD request

前端 未结 4 930
情深已故
情深已故 2021-01-04 22:15

Im trying do do a HEAD Object request to the S3 REST API but I keep getting a 403 Forbidden error, even though I have the policy setup with the necessary permissions on S3.

4条回答
  •  孤街浪徒
    2021-01-04 22:55

    Additional comment on @Michael-sqlbot 's answer above ...

    I faced the identical symptoms but I had a different root cause.

    If you are trying to HEAD a file which does not exist, then this will also return a 403-forbidden error, UNLESS you have the s3:ListBucket permission.

    In my case, I had the s3.GetObject, s3.PutObject, and s3.HeadBucket permissions, but it wasn't until I added s3.ListBucket that I got the correct 404 - not found error.

    This is also explained here: https://aws.amazon.com/premiumsupport/knowledge-center/s3-rest-api-cloudfront-error-403/

提交回复
热议问题