Enhance your understanding of cross-account access using IAM roles with this quiz. Evaluate your knowledge of permissions, trust policies, role assumption, and secure practices for granting access across different cloud accounts.
Which statement best describes how cross-account access is typically established using IAM roles in cloud environments?
Explanation: Cross-account access usually involves an IAM user from one account assuming a role in another account, as defined by trust policies that grant such permission. Directly logging in with a role or exchanging passwords is not a secure or supported way to establish access. Sharing roles through public URLs would expose sensitive permissions and is not a recommended or feasible method.
What is the main purpose of the trust policy attached to an IAM role when enabling cross-account access?
Explanation: The trust policy determines which accounts or entities can assume the role, forming the basis of secure cross-account access. While billing, password policies, and activity logging are important, they are managed elsewhere and not the primary function of a trust policy. Therefore, only the first option correctly explains the purpose of a trust policy.
If Account A wants users to list storage buckets in Account B using a role, where should the necessary permissions be defined?
Explanation: Permissions for resources should be defined within the role's policy in Account B, granting the ability to list storage buckets. Assigning permissions in Account A's user policy will not extend to Account B's resources. Modifying bucket metadata alone won't grant cross-account access, and password policies are unrelated to resource permissions.
What is the primary function of the AssumeRole API in the context of cross-account access?
Explanation: The AssumeRole API is used to request temporary credentials to access resources as a specified role in a different account. It does not permanently assign permissions, create storage buckets, or synchronize passwords between accounts. The other options describe unrelated or incorrect actions.
What permission must an IAM user have in order to assume a role for cross-account access?
Explanation: The user must have permission to invoke the AssumeRole action specifically on the role’s resource to assume a role. Creating users or editing trust and password policies are different administrative activities and not prerequisites for assuming roles between accounts.
How long do the temporary credentials obtained from assuming a cross-account role typically remain valid unless otherwise specified?
Explanation: Temporary credentials from role assumption default to being valid for one hour, although the duration can sometimes be customized up to a maximum set by the role. Credentials do not last for a year, are never permanent, and five minutes would be uncommonly short and not the default.
When setting up a cross-account IAM role, what is a recommended best practice regarding permissions?
Explanation: Applying the principle of least privilege by granting only necessary permissions reduces security risks from over-privileged access. Allowing all actions introduces vulnerabilities, password reuse is insecure, and sharing access keys across roles undermines auditability and security.
If a user in Account A is unable to assume a role in Account B, what should you check first?
Explanation: The trust policy must explicitly allow Account A (or its users) to assume the role; otherwise, access is blocked. User email addresses, storage bucket names, and role-name/user-name matches do not fundamentally determine cross-account role access rights.
Which option would best help limit the risks associated with cross-account role sessions?
Explanation: Requiring MFA adds an extra layer of security to role assumption, verifying the user's identity. Disabling time restrictions increases risk, while anonymous use or sharing credentials weakens accountability and access control, making these poor choices for limiting risks.
When a user receives temporary credentials by assuming a cross-account IAM role, what is the secure way to use them?
Explanation: Temporary credentials should be used exclusively for the allowed tasks and only while they are valid. Publishing, converting, or sharing the credentials undermines security and opens the account to unauthorized or malicious access. Keeping credentials private and task-specific is the secure and intended practice.