AWS Certified Developer – Associate — Question 332
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 IAM role assigned to the EC2 instances in Account B must be granted explicit permission to perform the 'sts:AssumeRole' action on the AccessPII role in Account A. In addition, the application code itself must invoke the AssumeRole API to exchange its current identity for temporary credentials associated with the AccessPII role. Other options like GetSessionToken or direct table access are incorrect because cross-account delegation specifically requires the AssumeRole API and appropriate trust/identity policies.