Bird
0
0

How would you write an IAM policy statement that denies all actions except 's3:ListBucket' on a specific bucket 'data-bucket'?

hard📝 Best Practice Q9 of 15
AWS - Identity and Access Management
How would you write an IAM policy statement that denies all actions except 's3:ListBucket' on a specific bucket 'data-bucket'?
A{"Effect": "Deny", "Action": "s3:ListBucket", "Resource": "arn:aws:s3:::data-bucket"}
B{"Effect": "Allow", "Action": "s3:ListBucket", "Resource": "arn:aws:s3:::data-bucket"}
C{"Effect": "Deny", "NotAction": "s3:ListBucket", "Resource": "arn:aws:s3:::data-bucket"}
D{"Effect": "Allow", "NotAction": "s3:ListBucket", "Resource": "arn:aws:s3:::data-bucket"}
Step-by-Step Solution
Solution:
  1. Step 1: Understand the use of "NotAction" with "Deny"

    "NotAction" with "Deny" denies all actions except those listed.
  2. Step 2: Confirm the resource and action

    {"Effect": "Deny", "NotAction": "s3:ListBucket", "Resource": "arn:aws:s3:::data-bucket"} denies all except "s3:ListBucket" on 'data-bucket', matching the requirement.
  3. Final Answer:

    Deny NotAction "s3:ListBucket" -> Option C
  4. Quick Check:

    Deny + NotAction = deny all except listed [OK]
Quick Trick: "NotAction" with Deny excludes listed actions from denial [OK]
Common Mistakes:
MISTAKES
  • Using Allow instead of Deny
  • Confusing Action and NotAction
  • Denying the allowed action by mistake

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes