Course menuDVA-C03

Exams / DVA-C03 / IAM roles, policies and STS / Question 1

DVA-C03 practice question: IAM roles, policies and STS (1 of 3)

Security A free question from our original DVA-C03 practice exam. Try it, then open the answer to see why each option is right or wrong.

Last verified against current AWS documentation ·How we write our questions

A Lambda function in account 111111111111 saves orders to a DynamoDB table in account 222222222222.

The security team for account 222222222222 requires that the function reaches the table only through an IAM role that they own and control, and no long-term credentials may be stored anywhere. The function's code uses the AWS SDK.

Which TWO steps are required? (Choose two.)

Choose two answers.

  1. A. In account 222222222222, create a role with write access to the table and a trust policy that names the function's execution role.
  2. B. Attach a resource-based policy to the table that allows the function's execution role to call dynamodb:PutItem.
  3. C. Add a statement to the function's resource-based policy that allows the role in account 222222222222 to invoke the function.
  4. D. Allow sts:AssumeRole on the role's ARN in the execution role, and have the code call AssumeRole to get temporary credentials.
  5. E. Create an IAM user in account 222222222222 with table access, and keep its access key in AWS Secrets Manager for the function.
Show the answer and explanation

Answers: A, D

Explanation

Cross-account role access needs both sides: the role in the table's account must trust the function's execution role, and the execution role must be allowed to call sts:AssumeRole on that role. The code then uses the temporary credentials. A table resource policy or an IAM user's keys would reach the table but not through a role the table owner controls without stored secrets.

Cross-account access through an IAM role In the calling account, the application role is allowed to call sts:AssumeRole. In the resource account, a cross-account role trusts the application role and has permissions on a DynamoDB table. AssumeRole returns temporary credentials, which the application uses to reach the table. Calling account Resource account App role may call AssumeRole Cross-account role trusts the app role Temporary credentials DynamoDB table role's permissions
Both sides are needed: the role trusts the execution role, and the execution role may call sts:AssumeRole on it.

Study

Keep practicing

Answer questions with a score at the end, or practice just this topic with the explanation after each one. No sign-up needed.

Want more on IAM roles, policies and STS? The 5 full-length practice sets have 15 more IAM roles, policies and STS questions, 390 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets