Bird
0
0

Which policy statement correctly achieves this?

hard📝 Best Practice Q15 of 15
AWS - Identity and Access Management
You want to create an IAM policy that allows a user to read objects only from a specific S3 bucket named "my-data-bucket" but denies deleting any objects. Which policy statement correctly achieves this?
A{ "Effect": "Allow", "Action": ["s3:GetObject"], "Resource": "arn:aws:s3:::my-data-bucket/*" }
B{ "Effect": "Allow", "Action": ["s3:GetObject", "s3:DeleteObject"], "Resource": "arn:aws:s3:::my-data-bucket/*" }
C{ "Effect": "Deny", "Action": "s3:DeleteObject", "Resource": "arn:aws:s3:::my-data-bucket/*" }
D{ "Effect": "Allow", "Action": "s3:*", "Resource": "arn:aws:s3:::my-data-bucket" }
Step-by-Step Solution
Solution:
  1. Step 1: Identify required permissions

    The user needs permission to read objects only, which is "s3:GetObject" on the bucket's objects.
  2. Step 2: Check for delete denial

    Not including "s3:DeleteObject" means no delete permission is granted. Explicit deny is not required if no allow exists.
  3. Step 3: Validate resource ARN

    The resource must include "/*" to specify objects inside the bucket, not the bucket itself.
  4. Final Answer:

    Allow s3:GetObject on objects in my-data-bucket only -> Option A
  5. Quick Check:

    Allow read only, no delete = { "Effect": "Allow", "Action": ["s3:GetObject"], "Resource": "arn:aws:s3:::my-data-bucket/*" } [OK]
Quick Trick: Allow only needed actions; omit delete to deny it [OK]
Common Mistakes:
  • Allowing delete by mistake
  • Using bucket ARN without /* for objects
  • Using wildcard s3:* granting too many permissions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes