You have an IAM policy that allows full access to all S3 buckets. Which option correctly restricts access to only the bucket named my-company-data?
Think about the difference between bucket and object ARNs in S3.
Option A correctly restricts access to all objects within the bucket my-company-data by specifying both the bucket ARN and the objects ARN with a trailing /*. Option A only allows access to the bucket itself, not the objects inside. Option A allows access to all buckets. Option A adds an unnecessary condition that does not restrict access properly.
Which option best describes when to use an IAM role instead of an IAM user?
Think about temporary credentials and automatic rotation.
IAM roles provide temporary credentials and are ideal for applications running on AWS services like EC2. IAM users are for long-term credentials, typically for humans. Temporary access is best handled by roles, not users.
You need to design IAM policies for a team that manages EC2 instances but should not modify S3 buckets. Which approach follows the least privilege principle?
Least privilege means granting only what is needed, nothing more.
Option B grants only the necessary EC2 permissions and does not grant any S3 permissions, which aligns with least privilege. Option B uses explicit deny which is less preferred if permissions can be omitted. Options C and D grant more permissions than needed.
An IAM user has a policy that requires MFA for deleting S3 buckets. What happens if the user tries to delete a bucket without MFA?
Consider how MFA conditions affect permission evaluation.
If a policy requires MFA for an action, the action is denied if MFA is not present in the request. So deleting without MFA fails.
You want to allow an IAM user in Account A to access resources in Account B using an IAM role. Which configuration is required in Account B's role trust policy?
Think about how trust policies specify principals for cross-account roles.
Trust policies for cross-account roles typically specify the AWS account ID as the principal to allow any trusted identities from that account to assume the role.