Skip to main content

Command Palette

Search for a command to run...

AWS 🔐 IAM Basics: Users, Groups, Roles & Policies

Learn how IAM secures AWS with users, groups, roles, and policies; The foundation of DevOps & DevSecOps.

Updated
AWS 🔐 IAM Basics: Users, Groups, Roles & Policies
A
🚀 Code. Automate. Innovate. Hi, I’m Abdulrahman, a passionate DevOps Engineer and Software Developer on a mission to bridge the gap between code and production. With a love for automation, cloud-native solutions, and cutting-edge tech, I turn complex problems into seamless, scalable systems. 💡 What I Do: Build robust CI/CD pipelines that deliver software at the speed of thought. Architect cloud infrastructure that scales with a single command. Transform manual processes into automated workflows that just work. Break down silos and foster collaboration between teams. 🔧 Tech Stack I ❤️: Containers (Docker), Orchestration (Kubernetes), Infrastructure as Code (Terraform), CI/CD (Jenkins, GitLab), Cloud (AWS/GCP/Azure), and scripting like it’s my superpower. 📝 Why This Blog? This is where I share my journey, lessons learned, and the latest trends in DevOps and software engineering. Whether you're a seasoned pro or just starting out, join me as we explore the tools, tricks, and best practices that make the tech world tick. 🌟 Let’s Build the Future, One Pipeline at a Time. Connect with me, share your thoughts, and let’s automate the world together!

🎯 Target Audience: Beginners in DevOps & DevSecOps
🧠 Key Concepts: IAM Users, Groups, Roles, Policies, Least Privilege
Estimated Read Time: ~9 minutes
📚 Series: Part of “AWS & Cloud Computing for DevOps Beginners”
🌍 Real-World Focus: Securing access & automation in AWS


Why IAM Matters in DevOps

Imagine AWS as a huge airport ✈️.
EC2 = airplanes, S3 = hangars, RDS = control towers…

Now, who decides who gets into which area? That’s IAM (Identity & Access Management).

Without IAM, AWS would be like an airport without security gates. Total chaos 😅.

As a DevOps engineer, IAM is your first line of defense: it’s where DevOps meets DevSecOps.


1️⃣ IAM Users → People with Access

An IAM User = an actual person (or sometimes a bot) who needs to log in.

Example:

  • A Developer who needs to pull artifacts from S3.

  • Ops engineer who deploys to EC2.

Command Line Example:

aws iam create-user --user-name devops_engineer

⚠️ Mistake to Avoid: Don’t use the root AWS account for daily tasks. Create IAM users with just the permissions they need.


2️⃣ IAM Groups → Teams, Not Individuals

Groups = collections of users with the same permissions.

Example:

  • Developers group → read-only access to logs.

  • Admins group → elevated permissions.

This way, instead of editing 10 user accounts, you update the group once.

Quick Command Example:

aws iam create-group --group-name Developers
aws iam add-user-to-group --user-name devops_engineer --group-name Developers

👉 Real-World Use Case: Onboarding a new junior DevOps → just add them to the right group. Done ✅.


3️⃣ IAM Roles → Temporary Permission Jackets

Roles are like uniforms 👔. You “wear” them to temporarily get permissions.

  • EC2 instance role → allows EC2 to pull from S3.

  • Lambda role → lets your function write logs to CloudWatch.

The beauty? No hardcoding AWS keys.
Instead, AWS hands out temporary credentials behind the scenes.

Example: Attach role to EC2

aws iam create-role --role-name S3AccessRole \
  --assume-role-policy-document file://trust-policy.json

👉 DevSecOps Tip: Always prefer roles over static keys.


4️⃣ IAM Policies → The Rulebook

Policies = JSON documents that spell out who can do what.

Example policy to allow read-only S3:

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

Attach this to a user, group, or role, and they’ll only have read access.

👉 Real-World Example: Your CI/CD pipeline role only needs s3:GetObject and ec2:DescribeInstances — not AdministratorAccess.


Common Mistakes to Avoid

⚠️ Giving AdministratorAccess to everyone → recipe for disaster.
⚠️ Using root account for automation → never.
⚠️ Leaving old users active after offboarding → security hole.
⚠️ Hardcoding AWS keys in GitHub repos → huge 🚨.


Quick Recap

  • IAM Users → individual accounts.

  • IAM Groups → manage teams efficiently.

  • IAM Roles → temporary access for apps/services.

  • IAM Policies → JSON rules for permissions.

Master IAM early = you build secure pipelines and sleep better at night 😴.


IAM might look “basic,” but it’s the backbone of AWS security.
Next up: AWS Management Console vs CLI vs SDK: What DevOps Engineers Should Use.

👉 Question for you: Have you ever seen someone accidentally leave AdministratorAccess on a user? What happened? 😅


👨‍💻 Written by: Abdulrahman A. Muhamad
🌐 LinkedIn | GitHub | Portfolio

AWS for DevOps Beginners: From Basics to DevSecOps

Part 3 of 9

Beginner-to-advanced AWS series for DevOps engineers. Learn cloud basics, IAM, compute, networking, storage, databases, monitoring, IaC, CI/CD & DevSecOps with hands-on workflows to grow from AWS newbie to confident pro.

Up next

AWS Management Console vs CLI vs SDK: What DevOps Engineers Should Use

Learn the differences between AWS Console, CLI, and SDK, and when DevOps engineers should use each for automation and security.