AWS IAM β Identity and Access Management
Before you start: basic AWS familiarity (what a Region and an AWS account are β see the AWS Core Services Overview if you haven't yet) is assumed. No prior identity/access-management experience is needed.
IAM is the security foundation of AWS. Every API call to AWS goes through IAM for authentication and authorization. Getting IAM right is the difference between a secure cloud environment and a breach.
Why This Exists (The Hook)
Anyone who can reach AWS's API can, in principle, ask it to do anything β launch servers, read every S3 bucket, delete a database. Without a gatekeeper checking "who is asking, and are they allowed to do this specific thing," a cloud account is just an open door. IAM is that gatekeeper: it sits in front of every single API call AWS receives, checks the identity making the request against a set of written rules (policies), and only lets the request through if a rule explicitly allows it.
Analogy β Think of IAM like a building's badge-access security desk. A user is a permanent employee badge β it exists indefinitely and opens whatever doors it's been granted. A role is a visitor badge issued at the front desk for the duration of one visit β it expires and is reissued fresh each time, which is exactly why AWS services (which come and go) should use roles, not permanent employee badges. A policy is the actual access list taped to each door, naming which badges may open it. The security desk (IAM's policy evaluation engine) checks every single door attempt against that list, every time β no badge gets to just walk in because it looks legitimate.
Try it (2 minutes) β Reason through IAM's deny-wins evaluation logic without needing console access: imagine a user is a member of two IAM groups. Group A's policy explicitly allows s3:DeleteObject on a bucket. Group B's policy explicitly denies s3:DeleteObject on the same bucket. The user makes a delete request β does it succeed? Now imagine Group B's policy is removed entirely, and no policy anywhere mentions s3:DeleteObject for this user. Does the request succeed this time? (The two answers are different, and the reason is the "implicit deny" rule below.)
Core Concepts
Principal β Who is making the request. Can be an IAM user, IAM role, AWS service, or federated identity.
Authentication β Verifying identity (who are you?). Done via access keys, passwords, or temporary credentials.
Authorization β Verifying permissions (what can you do?). Done via IAM policies evaluated at request time.
Policy β JSON document defining permissions. Attached to users, groups, or roles.
Effect/Action/Resource β The core of every policy statement:
IAM Entities
IAM Users β Long-term identities for humans or applications. Have permanent credentials (password + access keys). Avoid creating users for applications β use roles instead.
IAM Groups β Collection of users. Attach policies to groups, add users to groups. Cannot nest groups. Makes permission management scalable.
IAM Roles β Temporary identity assumed by AWS services, EC2 instances, Lambda functions, or federated users. No permanent credentials β STS issues temporary tokens. This is the right way to give AWS services permissions.
IAM Policies β JSON permission documents. Types:
Policy Evaluation Logic
With multiple policies, all are evaluated together. Any explicit deny overrides any allow. No allow = implicit deny.
IAM Best Practices
1. Never use root account β Create an admin IAM user immediately after account creation. Enable MFA on root. Lock away root credentials.
2. Least privilege β Start with minimal permissions, add as needed. Use IAM Access Analyzer to find unused permissions.
3. Use roles, not users for applications β EC2 instance roles, Lambda execution roles, ECS task roles. Never hardcode access keys.
4. Enable MFA everywhere β Virtual MFA (Google Authenticator) at minimum. Hardware keys for privileged accounts.
5. Rotate access keys β If you must use access keys, rotate them regularly. Use IAM credential report to find old keys.
6. Use permission boundaries β Limit max permissions a role/user can have, even if more permissive policies are attached.
7. Use Service Control Policies (SCPs) β In AWS Organizations, SCPs are guardrails at the account or OU level that even override admin permissions.

