How IAM Conditions Improve AWS Security with Detailed Access Permissions


Arjun, our go-to cloud enthusiast, had come a long way in his AWS learning journey. He had just wrapped his head around IAM users, roles, and permissions when he stumbled upon something intriguing: IAM Policy Conditions.
"Wait… I can control when, where, and how someone can use their AWS permissions?" Arjun asked aloud, sipping his chai.
☁️ What are IAM Conditions?
Imagine giving someone the keys to your office — but only letting them enter during office hours, from a specific building, and only if they carry an ID badge.
In AWS IAM conditions are the part of a policy that lets you define when, where, or how a permission should apply.
You already know that IAM policies have:
Effect
– Allow or DenyAction
– What the user can doResource
– What the user can access
But conditions go a step further. They add contextual rules to those permissions.
Think of it like saying:
“Yes, Arjun can access EC2...
but only if he’s in Mumbai, using MFA, and managing Dev-tagged servers.”
With conditions, AWS gives you fine-grained control using:
IP addresses
MFA status
Tags
AWS region
Organizational account IDs, etc.
You define conditions using condition keys, and these keys vary based on service and scenario.
🔐 1. aws:SourceIp
– Locking Access to Company Network
Arjun wanted to make sure no one accessed critical resources outside his office Wi-Fi.
So, he used this:
"Condition": {
"NotIpAddress": {
"aws:SourceIp": ["192.168.0.0/24"]
}
}
✅ Only allow API calls from the company network
🌍 2. aws:RequestedRegion
– Restricting to Specific AWS Regions
To avoid surprises (and extra billing), Arjun wanted to block access to regions his company doesn’t operate in.
"Condition": {
"StringEquals": {
"aws:RequestedRegion": "us-east-1"
}
}
✅ Make sure resources are created only in approved regions
🏷️ 3. ec2:ResourceTag
+ aws:PrincipalTag
– Tag-Based Control
You can use tags on AWS resources and users to control who can do what.
There are two types of tag-based conditions:
ec2:ResourceTag/
– This checks the tag on the EC2 instance.aws:PrincipalTag/
– This checks the tag on the IAM user or role making the request.
👉 Example:
Allow a user to start or stop EC2 instances only if:
The instance is tagged with
Project = DataAnalytics
The user is tagged with
Department = Data
This means:
Users from other departments can’t touch those EC2s
EC2s without the correct tag are also protected
This is super useful for project isolation, billing, and delegated control without writing complex roles for every use case.
"Condition": {
"StringEquals": {
"ec2:ResourceTag/Project": "DataAnalytics",
"aws:PrincipalTag/Department": "Data"
}
}
✅ Let users manage only resources that match their project or department
🔐 4. aws:MultiFactorAuthPresent
– Enforcing MFA for Sensitive Actions
Some permissions are too powerful to allow without extra security.
"Condition": {
"BoolIfExists": {
"aws:MultiFactorAuthPresent": "true"
}
}
✅ Require MFA before allowing TerminateInstance
or DeleteBucket
📦 5. S3 Bucket Policy Example
Arjun made a common mistake: he used the wrong ARN in an S3 bucket policy.
ere’s the trick:
✅ To give access to the bucket itself (like listing all files), use:
arn:aws:s3:::my-bucket
✅ To give access to the files inside the bucket, use:
arn:aws:s3:::my-bucket/*
🔑 Why it matters:
AWS treats the bucket and the objects inside it as separate things when it comes to permissions.
So if your IAM policy or bucket policy uses the wrong ARN, users might get a "Permission Denied" error even if everything else looks fine.
🪣 What Happens When You Grant Access Only to the Bucket Level?
When you grant access like this:
"Resource": "arn:aws:s3:::my-bucket"
You're only giving permissions to the bucket itself — not the files inside it.
This allows actions like:
ListBucket
→ which means: "Show me the list of file names in the bucket."
But…
🚫 The user still cannot open, download, or upload any files unless you also give access to:
"Resource": "arn:aws:s3:::my-bucket/*"
✅ Use correct ARN type for each operation: listing a bucket vs. reading an object
🧠 Why Give Bucket-Level Access Alone?
There are valid reasons to grant just bucket-level access:
📂 Allow listing file names only — maybe the user should know what’s in the bucket, but not download anything.
🔍 Audit/monitoring tools that only need to scan or verify contents.
🔐 Tight control — sometimes, you want to split access: one team lists files, another can download/upload.
✅ Pro Tip for IAM or S3 Policies:
For full access to list and manage objects, always combine both:
"Resource": [
"arn:aws:s3:::my-bucket", // for ListBucket
"arn:aws:s3:::my-bucket/*" // for GetObject, PutObject, etc.
]
🏢 6. aws:PrincipalOrgID
– Let Only Org Members In
Arjun’s company had multiple AWS accounts under AWS Organizations.
To prevent outsiders from accessing an S3 bucket, he used:
"Condition": {
"StringEquals": {
"aws:PrincipalOrgID": "o-1234567890"
}
}
✅ Only allow access from accounts inside your AWS Organization
🔚 Wrapping Up – Why Conditions Matter
Arjun realized that IAM conditions aren't just security features — they’re security enablers.
They help you:
Lock access to your trusted environment
Comply with regional data rules
Enforce least-privilege access with laser precision
“It’s not just who can do what… It’s also when, where, and how.”
– Arjun, now IAM ninja 🥷
📘 Quick Recap: IAM Condition Keys Arjun Used
Condition Key | Use Case |
aws:SourceIp | Restrict access to IP ranges |
aws:RequestedRegion | Block regions you don’t use |
ec2:ResourceTag | Access only tagged EC2 instances |
aws:PrincipalTag | Access only if user has specific tag |
aws:MultiFactorAuthPresent | Enforce MFA for actions |
aws:PrincipalOrgID | Allow only AWS Org members to access resources |
Follow me for more such content
Subscribe to my newsletter
Read articles from Jay Tillu directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Jay Tillu
Jay Tillu
Hello! I'm Jay Tillu, an Information Security Engineer at Simple2Call. I have expertise in security frameworks and compliance, including NIST, ISO 27001, and ISO 27701. My specialities include Vulnerability Management, Threat Analysis, and Incident Response. I have also earned certifications in Google Cybersecurity and Microsoft Azure. I’m always eager to connect and discuss cybersecurity—let's get in touch!