Bird
Raised Fist0
DynamoDBquery~20 mins

IAM policy for DynamoDB - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
DynamoDB IAM Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ service_behavior
intermediate
2:00remaining
Which IAM policy allows full access to a specific DynamoDB table?
Given the following IAM policy, what is the effect on the DynamoDB table named OrdersTable?
DynamoDB
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "dynamodb:*",
      "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/OrdersTable"
    }
  ]
}
AAllows read-only actions on all DynamoDB tables in the account.
BAllows all DynamoDB actions on all tables in the us-east-1 region.
CDenies all actions on the OrdersTable.
DAllows all DynamoDB actions on the OrdersTable only.
Attempts:
2 left
💡 Hint
Look at the Action and Resource fields carefully.
❓ security
intermediate
2:00remaining
Which IAM policy snippet restricts DynamoDB write actions but allows read actions on all tables?
Select the policy snippet that correctly restricts write actions (PutItem, UpdateItem, DeleteItem) but allows read actions (GetItem, Query, Scan) on all DynamoDB tables.
A
{
  "Effect": "Allow",
  "Action": ["dynamodb:GetItem", "dynamodb:Query", "dynamodb:Scan"],
  "Resource": "arn:aws:dynamodb:*:*:table/*"
}
B
{
  "Effect": "Deny",
  "Action": ["dynamodb:PutItem", "dynamodb:UpdateItem", "dynamodb:DeleteItem"],
  "Resource": "arn:aws:dynamodb:*:*:table/*"
}
C
{
  "Effect": "Allow",
  "Action": "dynamodb:*",
  "Resource": "arn:aws:dynamodb:*:*:table/*"
}
D
{
  "Effect": "Allow",
  "Action": ["dynamodb:PutItem", "dynamodb:UpdateItem", "dynamodb:DeleteItem"],
  "Resource": "arn:aws:dynamodb:*:*:table/*"
}
Attempts:
2 left
💡 Hint
Focus on which actions are allowed and which are denied.
❓ Architecture
advanced
2:00remaining
What is the minimum IAM policy to allow a Lambda function to update items in a DynamoDB table named Users?
Choose the policy that grants only the necessary permissions for a Lambda function to update items in the DynamoDB table Users.
A
{
  "Effect": "Allow",
  "Action": "dynamodb:UpdateItem",
  "Resource": "arn:aws:dynamodb:us-west-2:123456789012:table/Users"
}
B
{
  "Effect": "Allow",
  "Action": "dynamodb:*",
  "Resource": "arn:aws:dynamodb:us-west-2:123456789012:table/Users"
}
C
{
  "Effect": "Allow",
  "Action": ["dynamodb:UpdateItem", "dynamodb:GetItem"],
  "Resource": "arn:aws:dynamodb:us-west-2:123456789012:table/Users"
}
D
{
  "Effect": "Allow",
  "Action": "dynamodb:UpdateItem",
  "Resource": "*"
}
Attempts:
2 left
💡 Hint
Minimal permissions mean only what is needed for update.
✅ Best Practice
advanced
2:00remaining
Which IAM policy practice improves security when granting DynamoDB access?
Select the best practice for writing IAM policies that grant access to DynamoDB tables.
AGrant full DynamoDB access (dynamodb:*) on all tables to reduce complexity.
BGrant access to DynamoDB tables using wildcard resource ARN like arn:aws:dynamodb:*:*:table/* for all users.
CUse resource-level permissions to restrict access to only required tables and actions.
DAvoid specifying resources and allow all actions globally for easier management.
Attempts:
2 left
💡 Hint
Think about the principle of least privilege.
🧠 Conceptual
expert
2:00remaining
What error occurs if an IAM policy denies all DynamoDB actions but a user has a separate policy allowing GetItem on a table?
If a user has two IAM policies: one explicitly denies all DynamoDB actions, and another allows only GetItem on a specific table, what is the effective permission when the user tries to perform GetItem?
AThe user can perform GetItem only if the deny policy is attached to a different user.
BThe GetItem action is denied because explicit deny overrides allow.
CThe user receives a syntax error due to conflicting policies.
DThe GetItem action is allowed because explicit allow overrides deny.
Attempts:
2 left
💡 Hint
Remember how AWS IAM evaluates deny and allow statements.

Practice

(1/5)
1. What does the Action element specify in an IAM policy for DynamoDB?
easy
A. The allowed or denied DynamoDB operations
B. The AWS region where the table is located
C. The encryption method used by the table
D. The billing mode of the DynamoDB table

Solution

  1. Step 1: Understand the role of Action in IAM policies

    The Action element defines which DynamoDB operations (like read, write) are allowed or denied.
  2. Step 2: Differentiate from other policy elements

    Other elements like Resource specify the table, but Action controls what can be done.
  3. Final Answer:

    The allowed or denied DynamoDB operations -> Option A
  4. Quick Check:

    Action = Allowed/Deny operations [OK]
Hint: Action controls what operations are allowed or denied [OK]
Common Mistakes:
  • Confusing Action with Resource
  • Thinking Action specifies table location
  • Mixing Action with encryption or billing settings
2. Which of the following is the correct syntax to specify a DynamoDB table resource ARN in an IAM policy?
easy
A. "Resource": "arn:aws:s3:::mybucket"
B. "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/MyTable"
C. "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table"
D. "Resource": "arn:aws:dynamodb:us-east-1:123456789012:database/MyTable"

Solution

  1. Step 1: Identify correct ARN format for DynamoDB table

    The ARN format for a DynamoDB table is: arn:aws:dynamodb:<region>::table/.
  2. Step 2: Compare options to the correct format

    "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/MyTable" matches the correct format exactly. "Resource": "arn:aws:s3:::mybucket" is for S3, C misses table name, D uses wrong resource type.
  3. Final Answer:

    "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/MyTable" -> Option B
  4. Quick Check:

    Resource ARN for DynamoDB table = "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/MyTable" [OK]
Hint: DynamoDB table ARN ends with 'table/YourTableName' [OK]
Common Mistakes:
  • Using S3 ARN format instead of DynamoDB
  • Omitting the table name in ARN
  • Using 'database' instead of 'table' in ARN
3. Given this IAM policy snippet, what DynamoDB actions are allowed?
{
  "Effect": "Allow",
  "Action": ["dynamodb:GetItem", "dynamodb:Query"],
  "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/Orders"
}
medium
A. Full access to all DynamoDB tables
B. Writing and deleting items in the Orders table
C. Only reading items from the Orders table
D. No access because the policy is incomplete

Solution

  1. Step 1: Analyze the Action list in the policy

    The policy allows only "dynamodb:GetItem" and "dynamodb:Query", which are read operations.
  2. Step 2: Check the Resource and Effect

    The resource is the Orders table only, and Effect is Allow, so only reading from Orders is allowed.
  3. Final Answer:

    Only reading items from the Orders table -> Option C
  4. Quick Check:

    Allowed actions = GetItem and Query (read) [OK]
Hint: GetItem and Query mean read-only access [OK]
Common Mistakes:
  • Assuming write or delete permissions are included
  • Thinking policy applies to all tables
  • Ignoring the Effect value
4. You wrote this IAM policy but it does not allow any access to your DynamoDB table. What is the error?
{
  "Effect": "Allow",
  "Action": "dynamodb:PutItem",
  "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table"
}
medium
A. Resource ARN is incomplete; missing table name
B. Action should be an array, not a string
C. Effect should be Deny to allow access
D. Policy is missing a Condition block

Solution

  1. Step 1: Check the Resource ARN format

    The ARN ends with 'table' but does not specify the table name, so it does not point to any specific table.
  2. Step 2: Understand impact of incomplete ARN

    Without a full ARN including the table name, the policy does not grant access to any resource.
  3. Final Answer:

    Resource ARN is incomplete; missing table name -> Option A
  4. Quick Check:

    Resource ARN must include table name [OK]
Hint: Resource ARN must specify full table name [OK]
Common Mistakes:
  • Thinking Action must be an array always
  • Confusing Effect Allow with Deny
  • Assuming Condition is required for access
5. You want to create an IAM policy that allows a user to read from any DynamoDB table in your account but only write to a specific table named 'Inventory'. Which policy setup is correct?
hard
A. { "Effect": "Allow", "Action": ["dynamodb:PutItem"], "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/*" }, { "Effect": "Allow", "Action": ["dynamodb:GetItem", "dynamodb:Query"], "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/Inventory" }
B. { "Effect": "Allow", "Action": ["dynamodb:GetItem", "dynamodb:Query", "dynamodb:PutItem"], "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/*" }
C. { "Effect": "Allow", "Action": "dynamodb:*", "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/Inventory" }
D. { "Effect": "Allow", "Action": ["dynamodb:GetItem", "dynamodb:Query"], "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/*" }, { "Effect": "Allow", "Action": ["dynamodb:PutItem"], "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/Inventory" }

Solution

  1. Step 1: Identify read permissions scope

    Read actions (GetItem, Query) should apply to all tables, so Resource uses wildcard '*'.
  2. Step 2: Identify write permissions scope

    Write action (PutItem) is limited to the 'Inventory' table only.
  3. Step 3: Match policy statements to requirements

    { "Effect": "Allow", "Action": ["dynamodb:GetItem", "dynamodb:Query"], "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/*" }, { "Effect": "Allow", "Action": ["dynamodb:PutItem"], "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/Inventory" } correctly separates read and write permissions with proper Resource ARNs.
  4. Final Answer:

    Separate statements: read on all tables, write only on Inventory -> Option D
  5. Quick Check:

    Read = all tables, Write = Inventory only [OK]
Hint: Use separate statements for different resource scopes [OK]
Common Mistakes:
  • Granting write access to all tables
  • Mixing read and write on wrong resources
  • Using wildcard for write when not intended
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard