IAM Least-Privilege Policy Synthesis
The Anti-Pattern: Wildcards
// PROHIBITED IN PRODUCTION
{
"Effect": "Allow",
"Action": "*",
"Resource": "*"
}
The Synthesized Standard: Action & Resource Scoping
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ReadOrdersStorageOnly",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::company-prod-orders",
"arn:aws:s3:::company-prod-orders/*"
],
"Condition": {
"Bool": {
"aws:SecureTransport": "true"
}
}
}
]
}
Policy Synthesis Procedure
- Analyze CloudTrail Events: Identify actual actions invoked by the identity over a 30-day window using Athena / CloudTrail Lake.
- Remove Write/Delete Privileges: Isolate read operations (
Get*, List*, Describe*) from mutation operations (Put*, Create*, Delete*).
- Bind to Specific ARNs: Replace
Resource: "*" with exact resource ARNs.
- Attach Security Conditions: Enforce
aws:SecureTransport: true (HTTPS only) and IP / VPC endpoint restriction condition keys.