Bird
0
0

You want to create an IAM policy that allows a user to read objects from any bucket but only write to a specific bucket named 'logs-bucket'. Which policy statement correctly implements this?

hard📝 Best Practice Q8 of 15
AWS - Identity and Access Management
You want to create an IAM policy that allows a user to read objects from any bucket but only write to a specific bucket named 'logs-bucket'. Which policy statement correctly implements this?
A{"Effect": "Allow", "Action": ["s3:GetObject", "s3:PutObject"], "Resource": "arn:aws:s3:::logs-bucket/*"}
B{"Effect": "Allow", "Action": ["s3:GetObject"], "Resource": "arn:aws:s3:::*/*"}, {"Effect": "Allow", "Action": ["s3:PutObject"], "Resource": "arn:aws:s3:::logs-bucket/*"}
C{"Effect": "Allow", "Action": ["s3:GetObject"], "Resource": "arn:aws:s3:::logs-bucket/*"}, {"Effect": "Allow", "Action": ["s3:PutObject"], "Resource": "arn:aws:s3:::*/*"}
D{"Effect": "Allow", "Action": ["s3:GetObject", "s3:PutObject"], "Resource": "arn:aws:s3:::*/*"}
Step-by-Step Solution
Solution:
  1. Step 1: Separate read and write permissions

    Read (GetObject) should apply to all buckets, write (PutObject) only to 'logs-bucket'.
  2. Step 2: Check the resource ARNs and actions in each option

    {"Effect": "Allow", "Action": ["s3:GetObject"], "Resource": "arn:aws:s3:::*/*"}, {"Effect": "Allow", "Action": ["s3:PutObject"], "Resource": "arn:aws:s3:::logs-bucket/*"} uses separate statements: GetObject on all buckets (arn:aws:s3:::*/*) and PutObject only on logs-bucket.
  3. Final Answer:

    GetObject on * and PutObject on logs-bucket only -> Option B
  4. Quick Check:

    Separate actions with correct resource ARNs = {"Effect": "Allow", "Action": ["s3:GetObject"], "Resource": "arn:aws:s3:::*/*"}, {"Effect": "Allow", "Action": ["s3:PutObject"], "Resource": "arn:aws:s3:::logs-bucket/*"} [OK]
Quick Trick: Use multiple statements to separate different resource permissions [OK]
Common Mistakes:
  • Combining read and write on all buckets
  • Reversing resource ARNs for actions
  • Using single statement for different resource scopes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes