Roles
Learn AWS IAM roles for temporary credentials, service permissions, cross-account access, federation, and secure application access.
Last reviewed: June 2026
🔍 What Is It?
An IAM role is an identity with permissions that can be assumed by trusted principals.
Roles do not have permanent passwords or access keys. They provide temporary credentials through AWS Security Token Service.
🎯 Why Do We Need It?
Roles reduce the need for long-lived credentials. They let EC2, Lambda, ECS, CodeBuild, and users access only what they need for a limited time.
Roles are central to cross-account access and enterprise federation.
Common developer mistakes:
- →Choosing defaults without checking security, cost, or failure behavior
- →Treating AWS services as isolated tools instead of part of an architecture
- →Skipping tags, alarms, IAM review, backups, and runbooks until production incidents happen
- →Building manually in the console and then struggling to reproduce environments
🏗️ What Happens in Real Projects?
A production EC2 instance profile lets an orders API read from a specific S3 bucket and write logs to CloudWatch. The instance never stores an access key.
A DevOps engineer signs in through SSO and assumes a deployment role in the staging account for a short session.
⚙️ How It Works
A role has a trust policy and permission policies.
The trust policy says who can assume the role. The permission policies say what the role can do after assumption. Temporary credentials expire and are rotated automatically for AWS service roles.
💻 Example
Role trust and permission model — A simplified service role design.
🤔 Common Confusions
❓ Is a role the same as a user?
No. A user is a long-term identity. A role is assumed temporarily by a trusted principal.
❓ What is a trust policy?
A trust policy defines who is allowed to assume the role.
❓ Can roles be used across accounts?
Yes. Cross-account role assumption is a standard enterprise pattern.
🚨 Common Production Issues
**Trust policy too broad** allows unintended principals to assume powerful roles.
**Permission policy too broad** turns service roles into lateral movement paths.
**No session controls** makes privileged access hard to trace.
**Using access keys instead of roles** creates avoidable credential leakage risk.
✅ Best Practices
Use roles for AWS service access
Use cross-account roles instead of shared users
Keep trust policies narrow
Use external IDs or conditions for third-party access
Set session duration appropriately
Monitor role assumption in CloudTrail
🏛️ Architect's Note
Roles are how mature AWS environments avoid permanent secrets. The trust policy is as important as the permission policy; one controls who gets in, the other controls what they can do.
💬 Frequently Asked Questions
🎯 Key Takeaways
🔗 Related Topics
🎯 Practice this topic in interviews
↗ Where this topic fits
AWS Technology Guide
Return to the AWS learning hub.
Backend Engineer Career Path
A structured journey through Core Java, Spring Boot, production backend engineering, and interview preparation.
Python Developer Career Path
A practical route through Python fundamentals, automation, backend basics, testing, projects, interview preparation, and career growth.
Sources
Sources / References
Use these AWS references to verify the concept in official docs and continue into the most relevant SplashRide pages.
Official documentation
Related SplashRide pages
SplashRide AWS learning path
Browse the full AWS topic collection and learning order on SplashRide.
AWS Interview Prep
Practice AWS interview questions and scenario-based answers.
Backend Engineer Career Path
A structured journey through Core Java, Spring Boot, production backend engineering, and interview preparation.
Python Developer Career Path
A practical route through Python fundamentals, automation, backend basics, testing, projects, interview preparation, and career growth.
IAM
Understand AWS Identity and Access Management for users, groups, roles, policies, least privilege, and enterprise access governance.
Policies
Understand IAM policies, resource policies, conditions, explicit deny, least privilege, and policy evaluation.