Why is an IAM role preferred over an IAM user with access keys for code running on an EC2 instance?
Correct answer
D. The role issues short-lived credentials through instance metadata, so no long-term secret is stored
16 views
D. The role issues short-lived credentials through instance metadata, so no long-term secret is stored
16 views
IAM roles are assumed through the instance metadata service, which issues temporary credentials that rotate automatically, so no long-lived secret sits on disk to leak. The role's trust policy lets EC2 assume it, and its permission policy still governs what those credentials may do. Long-term access keys remain a leading cause of leaked cloud credentials, which is why keyless workloads are preferred.
Asked in: NTS, PPSC IT, Campus Interviews
Not sure why the answer is D? Ask here and get an explanation.