Bird
0
0

You wrote this IAM policy to restrict access to items with partition key 'user456', but users still access other items:

medium📝 Debug Q14 of 15
DynamoDB - Security and Access Control
You wrote this IAM policy to restrict access to items with partition key 'user456', but users still access other items:
{
  "Effect": "Allow",
  "Action": "dynamodb:GetItem",
  "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/Orders",
  "Condition": {
    "StringEquals": {
      "dynamodb:LeadingKeys": "user456"
    }
  }
}

What is the likely error?
AAction should be dynamodb:Query instead of GetItem
BResource ARN is incorrect
CEffect should be Deny instead of Allow
DCondition should use ForAllValues:StringEquals with an array
Step-by-Step Solution
Solution:
  1. Step 1: Check condition syntax for dynamodb:LeadingKeys

    The condition expects an array with ForAllValues:StringEquals, not a single string with StringEquals.
  2. Step 2: Understand impact of incorrect condition

    Using StringEquals with a string causes the condition to be ignored, allowing broader access.
  3. Final Answer:

    Condition should use ForAllValues:StringEquals with an array -> Option D
  4. Quick Check:

    Use ForAllValues:StringEquals and array for LeadingKeys [OK]
Quick Trick: Use ForAllValues:StringEquals with array for LeadingKeys [OK]
Common Mistakes:
MISTAKES
  • Using StringEquals with a string instead of array
  • Incorrect ARN format
  • Confusing action types
  • Changing Effect to Deny unnecessarily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes