AWS Access - IAM Roles > IAM users
IAM users make it easy to grant access to AWS, but their long-lived credentials introduce security risks that every organization should understand.
TL;DR
While IAM Users may seem convenient, they can expose your AWS environment to unnecessary risk if used improperly. By adopting IAM Roles and federated access, you ensure your credentials are short-lived.
Intro
Among all the many services AWS offers, we could argue that IAM is the most critical one because, after all, it determines what access we have and even if we can access AWS at all.
Access to AWS is usually granted in one of two ways: using IAM users or assuming IAM roles.
You can think of IAM users as individual user accounts, similar to those you'd find on any website that requires a username and password to log in. Other than the password, each IAM user can have up to two Access Keys active at any given time. These function like traditional API keys, granting programmatic access to AWS.
IAM roles on the other hand represent specific functions or jobs, for example, an Administrator or Security Engineer role.
On their own, neither IAM users nor IAM roles grant any permissions. Instead, the IAM policies attached to them define what actions they are allowed to perform.
The Problem with IAM Users
IAM users are the easiest way to grant access to AWS. You create an user, share the credentials, and engineers can access from anywhere in the world.
This approach, however, is not free of issues.
IAM user passwords and access keys are long-lived credentials. By default, they do not expire unless the user or an administrator rotates them manually.
This creates several security risks:
- Long-Lived Credentials. The longer they are active, the greater the chance they could be compromised or leaked.
- Non-Compliance with Security Standards Most security standards and benchmarks recommend rotating credentials every 90 days. Failing to do so can result in compliance violations during audits.
- Lack of Proper Offboarding If an IAM user is created directly in AWS instead of through an Identity Provider, that user remains active even after an employee leaves the company, which means they could still log in later.
- Lack of visibility in large organizations IAM Users are local to each AWS account. In organizations with hundreds or thousands of accounts, tracking down a leaked access key or auditing active credentials becomes painful and time-consuming
Best practices
The recommendation is to replace IAM Users with IAM Roles. Sure, there may be cases where IAM users must be used, for instance, integrating with a vendor that doesn't support IAM Roles.
The point is to use IAM roles as much as possible as they use short-term credentials provided via AWS STS that are automatically rotated.
Consider also configuring a federation between your Identity Provider (IdP) and IAM or AWS Identity Center, especially if your organization manages multiple AWS accounts.
This approach not only improves security but also simplifies access management across teams and environments and increases visibility into the location of your IAM users across the AWS organization.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article