The Great AWS IAM Theater: Roles, Policies, and the Art of Access Control


The Mysterious Land of AWS Kingdom

    Once upon a time, in the vast AWS Kingdom, there were many digital citizens—EC2 , Lambda functions, users, and services—all trying to access different resources. But chaos loomed over the kingdom!
  • Some citizens tried to access the S3 without permission.
  • Others attempted to control EC2 without knowing the secret words.
  • And worst of all—some citizens had ALL the power but were careless! 
    Then, King AWS decreed: "Let there be IAM!" and thus, IAM Roles and Policies were born to restore order.


The Power of IAM Policies

    Policies are like magical scrolls that define who can do what. These scrolls have a special language called JSON

Example- 
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::treasure-chest/*"
        }
    ]
}

    Imagine a librarian allowing you to read books but not take them home. That’s how policies work!

Roles—The Magic Cloaks of AWS

    While policies define what can be done, roles decide who can wear them.

    Think of IAM Roles as magical cloaks that grant temporary powers:
  • The EC2 Explorer → Wears a role to read from S3
  • The Lambda Sorcerer → Wears a role to write logs in CloudWatch
  • The RDS Gatekeeper  → Wears a role to access databases

    Unlike users, roles don’t have passwords! Instead, AWS citizens (like EC2) assume roles dynamically when needed.

Example- 

An EC2 instance that needs to read from S3 should wear an IAM Role with the Read-Only Policy.

  1. The EC2 instance assumes the role.
  2. It gets temporary credentials (like a visitor pass).
  3. It fetches data from S3 without needing an access key!

IAM Best Practices—The Kingdom’s Rules

To maintain peace in AWS Kingdom, the wise IAM elders laid down some rules:
  1. Least Privilege Principle 
    → “Only give the necessary permissions. No extra power!”
  2. Use Roles Instead of Long-Term Keys 
    → “Visitors should get temporary passes, not permanent keys!”
  3. Enable Multi-Factor Authentication (MFA) 
    → “Make it harder for intruders to sneak in.”
  4. Regularly Audit IAM Permissions
    → “Check who has access to what, and revoke unused permissions.”

The Grand Finale: AWS IAM Saves the Day!

With IAM Roles and Policies in place, AWS Kingdom was finally at peace.
  • Policies defined what citizens could do 
  • Roles ensured the right citizens wore the right cloaks 
  • Best practices kept the kingdom secure


Comments

Popular posts from this blog

The Tale of cgroups: The Unsung Hero of Containers

Diving Deeper into Linux Namespaces and How They Complement Cgroups

Docker Demystified