Skip to main content

Offline IAM graph exporter + NLP query shell

Project description

Perfect. Here's a rewritten README.md that embraces the Red Pill / Blue Pill metaphor:


🗺️ 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

  1. Install the package:
pip install iam-map
  1. Export a graph:
iam-map export-graph --profile my-account
  1. Start ollama:
ollama run mistral
  1. 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 any or all
  • --group-logic any or all

💬 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iam_map-0.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iam_map-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file iam_map-0.1.0.tar.gz.

File metadata

  • Download URL: iam_map-0.1.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.9

File hashes

Hashes for iam_map-0.1.0.tar.gz
Algorithm Hash digest
SHA256 37adb72a9a0efbdad41ba0a0cde7d1da24c7b2b1878e914a537cbd40e1987663
MD5 86dbef512c0498c88897a984a50a8405
BLAKE2b-256 128d86321d2d7f1efb1844eda672ca43ced448fdba0ef0ed3d94c2c74968651a

See more details on using hashes here.

File details

Details for the file iam_map-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: iam_map-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.9

File hashes

Hashes for iam_map-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6fba64083dd12da1f89f53dc2c377478e1609185bbb0c69ccba108c230ab6906
MD5 be9ee3102dfd27e9c1d00b31c0480266
BLAKE2b-256 4b38b8f95828f521be5be01e5218b0fbbf99b6f58c69802723fe1a285d7e38f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page