AWS Certified Developer – Associate (DVA-C02) — Question 335
A company stores all personally identifiable information (PII) in an Amazon DynamoDB table named PII in Account A. Developers are working on an application that is running on Amazon EC2 instances in Account B. The application in Account B requires access to the PII table.
An administrator in Account A creates an IAM role named AccessPII that has permission to access the PII table. The administrator also creates a trust policy that specifies Account B as a principal that can assume the role.
Which combination of steps should the developers take in Account B to allow their application to access the PII table? (Choose two.)
Answer options
- A. Allow the EC2 IAM role the permission to assume the AccessPII role.
- B. Allow the EC2 IAM role the permission to access the PII table.
- C. Include the AWS API in the application code logic to obtain temporary credentials from the EC2 IAM role to access the PII table.
- D. Include the AssumeRole API operation in the application code logic to obtain temporary credentials to access the PII table.
- E. Include the GetSessionToken API operation in the application code logic to obtain temporary credentials to access the PII table.
Correct answer: A, D
Explanation
To enable cross-account access, the EC2 instance's IAM role in Account B must first have permissions to perform the sts:AssumeRole action on the AccessPII role in Account A. Additionally, the application code must call the AssumeRole API to retrieve the temporary credentials required to interact with the DynamoDB table. Direct permission assignment to the EC2 role for the table will not work across accounts, and GetSessionToken is not used for cross-account role assumption.