AWS Builder Center

AWS IAM Explained: How AWS Controls Access to Your Resources

A clear beginner’s guide to core cloud security principles, exploring how users, groups, roles, and JSON policies work together to protect your infrastructure.

When working with AWS, creating resources is only one part of building an application. You also need to control who can access those resources and what they are allowed to do.
This is where AWS Identity and Access Management (IAM) comes in.
IAM is an AWS service that lets you manage access to AWS resources. Instead of giving everyone access to everything, IAM allows you to define specific permissions for different users, applications, and services.
In this article, I’ll break down the main IAM concepts: users, groups, roles, and policies, and explain how they work together.

What is AWS IAM?

AWS IAM is a service used to control authentication and authorization within AWS.
These two concepts are important:
  • Authentication asks: “Who are you?”
  • Authorization asks: “What are you allowed to do?”
For example, imagine a developer signs into an AWS account. Authentication verifies their identity. IAM can then determine whether that developer is allowed to create an EC2 instance, access an S3 bucket, or modify a database.
This helps follow the principle of least privilege, which means giving someone only the permissions they actually need.

IAM Users

An IAM user represents an individual identity that can interact with AWS.
For example, a company might have separate IAM users for different employees:
1
2
3
Alice → Developer
Bob → Database Administrator
Charlie → Security Administrator
Each user can have different permissions depending on their responsibilities.
However, IAM users are not always the best solution for applications or automated systems. Instead of giving an application its own username and password, AWS provides another important concept: IAM roles.

IAM Groups

An IAM group is a collection of IAM users.
Groups make it easier to manage permissions for multiple users who have similar responsibilities.
For example:
1
2
3
4
Developers
├── Alice
├── Bob
└── Charlie
Instead of assigning the same permissions individually to Alice, Bob, and Charlie, an administrator can assign the permissions to the Developers group.
If another developer joins the team, they can simply be added to the group and inherit its permissions.
This makes permission management much easier as an organization grows.

IAM Policies

So how does AWS actually know what someone is allowed to do?
This is where IAM policies come in.
A policy is a document that defines permissions. Policies are commonly written in JSON.
A simplified example might look like this:
1
2
3
4
5
6
7
8
9
10
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-bucket/*"
}
]
}
This policy allows someone to retrieve objects from a specific S3 bucket.
There are three important parts to notice:
  • Effect determines whether the action is allowed or denied.
  • Action specifies what operation can be performed.
  • Resource specifies which AWS resource the permission applies to.
For example:
1
2
3
Effect: Allow
Action: s3:GetObject
Resource: my-bucket
This means the identity can read objects from that bucket.
Policies can become much more specific depending on what access is required.

IAM Roles

IAM roles are especially important when applications and AWS services need to interact with each other.
Unlike an IAM user, a role is not permanently associated with one person.
Instead, a role can be assumed by a trusted entity, such as an AWS service, application, or user.
For example, imagine you have an application running on an EC2 instance that needs to retrieve files from S3.
One approach would be to give the application AWS access keys.
However, storing long-term credentials inside an application is a security risk.
Instead, you can create an IAM role:
1
2
3
4
5
6
7
EC2 Instance
↓
IAM Role
↓
S3 Permissions
↓
S3 Bucket
The EC2 instance can assume the role and receive temporary credentials that allow it to access the S3 bucket.
This avoids putting long-term AWS credentials directly into the application.

Users vs. Roles

At first, IAM users and roles can seem similar, but they serve different purposes.
IAM UsersIAM Roles
Usually represent individual identitiesProvide permissions that can be assumed
Can have long-term credentialsUse temporary credentials when assumed
Useful for specific human identitiesUseful for AWS services, applications, and temporary access
Can belong to groupsCan be assumed by trusted entities
For modern AWS applications, roles are especially important because they allow services to communicate securely without embedding permanent credentials in application code.

How IAM Concepts Work Together

Let's put everything together with a simple example.
Imagine a company has three developers:
1
2
3
4
5
6
7
Developers Group
↓
IAM Users
↓
IAM Policies
↓
AWS Resources
The developers might be allowed to deploy applications but not delete production databases.
Meanwhile, an application running on EC2 might use a role:
1
2
3
4
5
6
7
EC2 Application
↓
IAM Role
↓
IAM Policy
↓
S3 Bucket
The application can then access only the resources it needs.
This separation makes the system easier to manage and more secure.

The Principle of Least Privilege

One of the most important ideas when working with IAM is least privilege.
Instead of giving an identity broad permissions such as:
1
Allow everything
you should give it only the permissions it actually needs.
For example, if an application only needs to read files from S3, it shouldn't also have permission to delete files.
A better permission would be:
1
2
Allow:
s3:GetObject
rather than:
1
2
Allow:
s3:*
The more specific the permissions, the smaller the potential impact if an account or application is compromised.

IAM and the AWS Root User

When an AWS account is first created, it has a root user.
The root user has extremely powerful permissions and should not be used for everyday tasks.
Instead, AWS recommends using more limited identities for normal activities and protecting the root user carefully.
This is another example of least privilege: if you only need permission to manage a particular service, you shouldn't be using an identity with unrestricted access to the entire AWS account.

Why IAM Matters for Developers

IAM isn't just an AWS administration topic. It is also important for software developers.
Applications frequently need to interact with cloud services.
For example:
1
2
3
4
5
Backend API
↓
Upload image
↓
Amazon S3
or:
1
2
3
4
5
Backend API
↓
Retrieve data
↓
Amazon DynamoDB
The application needs permission to perform these actions.
IAM allows developers to define exactly what the application can access without giving it unnecessary permissions.
This becomes especially important when deploying real applications to AWS, where security needs to be considered alongside functionality.

A Simple Mental Model

A simple way to remember the main IAM concepts is:
1
2
3
4
5
6
7
8
9
10
11
USER
Who is the identity?

GROUP
Who belongs together?

ROLE
Who or what can temporarily assume permissions?

POLICY
What are they allowed to do?
Together, these concepts form the foundation of access control in AWS.

Conclusion

AWS IAM provides the foundation for controlling access to AWS resources. By using users, groups, roles, and policies, you can determine who can access your resources and exactly what actions they are allowed to perform.
The biggest takeaway for me is that AWS security isn't just about keeping resources hidden. It's about giving each identity the right amount of access needed to perform its job.
As I continue learning AWS, understanding IAM is an important step toward being able to deploy applications securely rather than simply getting them to work.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article