Offline IAM graph exporter + NLP query shell
Project description
🗺️ IAM Map — AWS IAM Graph Analyzer
A powerful CLI to explore IAM users, groups, and policies across AWS accounts — with AI-powered natural language support via Ollama + Mistral.
💊 Choose Your Path
🔵 The Blue Pill — Just Install and Play
- 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-account
Example 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.
🔴 The Red Pill — Customize Everything
If you're a power user or developer, go deeper.
🔧 Install from Source
git clone https://github.com/yourname/iam-map.git
cd iam-map
pip install --editable .
📦 Requirements
- Python 3.8+
boto3,networkx,rich,typer- Ollama running locally with a model like
mistral
🧱 Project Structure
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
⚙️ Features
- 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
🧭 Usage
🔐 Configure Your AWS Profiles
aws configure --profile dev
aws configure --profile prod
Each IAM user must have these permissions:
{
"Action": [
"iam:ListUsers",
"iam:ListGroupsForUser",
"iam:ListAttachedUserPolicies",
"iam:ListAttachedGroupPolicies"
],
"Effect": "Allow",
"Resource": "*"
}
📤 Export IAM Graphs
iam-map export-graph --profile dev
# → creates: data/dev.dot
📊 Query Your IAM Graph
iam-map query-graph --dot-path data/dev.dot --include-policy AmazonEC2FullAccess
Add filters using:
--include-policy,--exclude-policy--include-group,--exclude-group--policy-logic anyorall--group-logic anyorall
💬 AI Shell (Natural Language)
iam-map shell --profile dev
By 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.
🌐 Graph Rendering (optional)
Generate diagrams from .dot files:
dot -Tpng data/dev.dot -o output/dev.png
Or PDF/SVG:
dot -Tsvg data/dev.dot -o output/dev.svg
Install Graphviz:
# macOS
brew install graphviz
# Ubuntu
sudo apt install graphviz
# Windows
choco install graphviz
📁 Output Locations
By default:
- Graphs →
data/ - Visuals →
output/
You can override these by setting environment variables:
export DATA_DIR=/custom/data
export OUTPUT_DIR=/custom/output
🧠 Powered By
- AWS IAM +
boto3 - Graph engine:
networkx - CLI:
typer,rich - Natural Language: Ollama + Mistral
✨ Why Use IAM Map?
✅ 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iam_map-0.2.1.tar.gz.
File metadata
- Download URL: iam_map-0.2.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fca07da8be15be211f7cdad78a9e3099c80915d31f956e3b751794743126f30
|
|
| MD5 |
f95cd4ff6a6da9f0ba1bebf2914357ff
|
|
| BLAKE2b-256 |
62f29a08a512ba1432832b252a7e413774f62700855e9d1c313c943f49107f8c
|
File details
Details for the file iam_map-0.2.1-py3-none-any.whl.
File metadata
- Download URL: iam_map-0.2.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ede8667e23387d35c63ea4cac9303d80792ce7aa9267e914e1c421e5f2076338
|
|
| MD5 |
420c7a78ee70656813b36e23b6e67f61
|
|
| BLAKE2b-256 |
67f19b9a55ca3d80dc7b031c65efc73b520dc2b647927e0da1772374418bbbf2
|