A powerful CLI to explore IAM users, groups, and policies across AWS accounts — with AI-powered natural language support via Ollama + Mistral.
- Install the package:
pip install iam-map- Export a graph:
iam-map export-graph --profile my-account- Start ollama:
ollama run mistral- Ask questions with natural language:
iam-map shell --profile my-accountExample prompts:
💬 > Who has EC2 or Lambda access but not S3?
💬 > Which users are in dev or test group with full Admin rights?
That’s it. Explore your IAM relationships like never before.
If you're a power user or developer, go deeper.
git clone https://github.com/yourname/iam-map.git
cd iam-map
pip install --editable .- Python 3.8+
boto3,networkx,rich,typer- Ollama running locally with a model like
mistral
iam_map/
├── cli.py ← main CLI
├── exporter.py ← fetch IAM data to .dot
├── graph_query.py ← query logic
├── ollama_client.py ← talk to Ollama API
├── paths.py ← path resolution
- Export IAM users, groups, and policies
- Query users using filters: policies, groups, logic
- List username + ID in rich table
- Support for multiple AWS accounts
- Natural language shell via Ollama
aws configure --profile dev
aws configure --profile prodEach IAM user must have these permissions:
{
"Action": [
"iam:ListUsers",
"iam:ListGroupsForUser",
"iam:ListAttachedUserPolicies",
"iam:ListAttachedGroupPolicies"
],
"Effect": "Allow",
"Resource": "*"
}iam-map export-graph --profile dev
# → creates: data/dev.dotiam-map query-graph --dot-path data/dev.dot --include-policy AmazonEC2FullAccessAdd filters using:
--include-policy,--exclude-policy--include-group,--exclude-group--policy-logic anyorall--group-logic anyorall
iam-map shell --profile devBy default, this:
-
Talks to http://localhost:11434
-
Sends your query to the mistral model via Ollama
To make that work, start the model manually (do this before you use iam-map):
ollama run mistral🔧 Customize Ollama Settings Running on a different model or port?
No problem:
iam-map shell --profile dev --port <your-port> --model <your-model>Requires:
- Ollama running locally
- Model like
mistral,llama3, etc.
Generate diagrams from .dot files:
dot -Tpng data/dev.dot -o output/dev.pngOr PDF/SVG:
dot -Tsvg data/dev.dot -o output/dev.svg# macOS
brew install graphviz
# Ubuntu
sudo apt install graphviz
# Windows
choco install graphvizBy default:
- Graphs →
data/ - Visuals →
output/
You can override these by setting environment variables:
export DATA_DIR=/custom/data
export OUTPUT_DIR=/custom/output- AWS IAM +
boto3 - Graph engine:
networkx - CLI:
typer,rich - Natural Language: Ollama + Mistral
✅ Works offline after export
✅ Lets you see IAM relationships
✅ Filters users like a database
✅ Natural language interface — no memorizing flags
✅ Clean CLI + optional visual outputs
Ready to map your IAM?
iam-map shell --profile your-account
🌍 Know your access. Map your roles. Secure your cloud.