NOFORN Presents: AWS IAM Policy Generator
python script to generate minified AWS IAM policies from a list of all known IAM actions
- Python >= 3.7
It's one action per line, plain text format: files/all-actions.txt
The base reference list is sourced from: rvedotrc/aws-iam-reference
You can add as many inline policies as you want to an IAM user, role, or group. But the total aggregate policy size (the sum size of all inline policies) per entity cannot exceed the following limits:
- User policy size cannot exceed 2,048 characters.
- Role policy size cannot exceed 10,240 characters.
- Group policy size cannot exceed 5,120 characters.
Note: IAM does not count white space when calculating the size of a policy against these limitations.
./generator.py --help
usage: generator.py [-h] -s SERVICES
NOFORN Presents: AWS IAM Policy Generator
optional arguments:
-h, --help show this help message and exit
-s SERVICES, --services SERVICES
The command separated list of AWS Services by their
service prefix.
./generator.py -s ec2
Great Success
AWS IAM policy generated: policy.json
./generator.py -s ec2,s3
Great Success
AWS IAM policy generated: policy.json
Error: IAM Actions are missing for the service
./generator.py -s ec3
Error: IAM Actions are missing for the service: ec3
Traceback (most recent call last):
File "./generator.py", line 46, in <module>
_actions = sorted(actions[service])
KeyError: 'ec3'
Resolution: Add missing IAM Actions to files/all-actions.txt
and re-run the generator.