Member-only story

Use Case: AWS IAM Roles vs AWS IAM Policies

Nazreen Mohamad
2 min readJul 14, 2023

--

Let’s get straight into it.

What are they?

IAM roles and policies are fundamental building blocks in AWS for managing access and permissions. They help maintain your AWS environment secure and controlled.

IAM policies are entities that, when attached to an identity or a resource, define their permissions. Policies determine who (or what) can perform which actions on what resources.

IAM roles, on the other hand, are an AWS identity with permission policies that determine what the identity can and cannot do. Roles do not have long-term credentials (access keys) associated. Instead, when you assume a role, it provides you with temporary security credentials.

The Use Case

Imagine you have an EC2 instance that needs to read data from an S3 bucket. What do you use, IAM roles or IAM policies?

Understanding IAM Policies

You can attach a policy directly to an EC2 instance. The policy might state something like this: “Allow this EC2 instance to read from this specific S3 bucket”. The policy states the permissions and the resource for this particular EC2 instance.

This approach works well if you have a limited number of resources and want to define specific permissions for each. However, as the number of resources increases, managing individual policies becomes cumbersome.

--

--

Nazreen Mohamad
Nazreen Mohamad

Written by Nazreen Mohamad

Technical Instructor and Software Engineer.

No responses yet