testerboy
testerboy

Reputation: 79

S3 bucket policy error "Conditions do not apply to combination of actions and resources in statement"

I tried to create a s3 bucket policy with action:
"Action": ["s3:GetObject", "s3:PutObject", "s3:PutObjectAcl" ]

and a condition as below
"Condition": { "StringLike": {"s3:x-amz-acl": " bucket-owner-full-control"}}

But it throws the below error: Conditions do not apply to combination of actions and resources in statement

  1. What exactly is this error?
  2. Can someone help me why is this error occurring
  3. what will be the solution.

Actually tried to add the whole policy but was not able to do so. Thanks

Upvotes: 0

Views: 1767

Answers (1)

Chris Williams
Chris Williams

Reputation: 35238

According to the S3 documentation the below is why you receive this error.

The condition key s3:x-amz-acl that you can use to grant condition permission for the s3:PutObject permission defines behavior of the x-amz-acl request header that the PUT Object API supports.

Essentially this condition key is bound to PutObject only, therefore your condition could never be evaluated for s3:GetObject or s3:PutObjectAcl.

If both these actions should be supported too you will need to add these actions as an additional statement to the bucket policy without the condition attached.

Upvotes: 3

Related Questions