Skip to main content

Realtime monitor for IAM activity for IaC projects

Project description

IAM Action Watcher

Monitors IAM activities (Actions) for a given user or role in realtime. Outputs a list of actions to help construct a policy document.

"A CLI helper tool which runs alongside your IaC project to determine exactly what permissions your policy will require"

> poetry run iam_watching
No user specified
Using sts identity: arn:aws:sts::[account_id]:assumed-role/[role_name]/[session_tag]

        Watching every 5s for last 50
        operations currently being performed by testuser
        Events can take up to 2 minutes to show up

        Displaying unique actions only

        Hit Ctrl+C to stop watching security events


2025-08-18 15:28:07-07:00 | ec2:DescribeInstances
2025-08-18 15:21:10-07:00 | rds:DescribeDBClusters
2025-08-18 15:21:04-07:00 | iam:GetUser
^C
        The following actions were recently
        performed by testuser:

"Action": [
  "ec2:DescribeInstances",
  "rds:DescribeDBClusters",
  "iam:GetUser"
]

Why?

With AWS IAM it can be hard to know exactly what permissions are required to run your code. IaC tooling makes many different API calls invoking actions requiring specific permissions.

E.g: Running a few different high-level functions on a simple program/module will do different things:

  • refresh makes 'list/describe/get' calls
  • up/apply makes 'create' calls
  • down/destroy makes 'destroy/delete/deregister/de-provision' calls

I've found there is no good way to know exactly what these calls will be until all the functions have been tested and this usually means a lot of back & forth debugging to raise or lower access permissions to a reasonable level. Best-practice for IaC is a policy carrying the exact/minimum security.

This simple CLI tool monitors CloudTrail for all security actions performed by a user/principal during a time window, this removes the guesswork and toil of testing every function to failure.

By default the program will detect if you are authenticated as a traditional iam/user or a modern sts/session. But you can still over-ride which events you want to see with the --user flag.

Developing

Running it locally

poetry install
poetry run iam_watching

Install from PyPi

pipx install iam_watching
iam_watching --help

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_watching-1.5.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

iam_watching-1.5.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file iam_watching-1.5.0.tar.gz.

File metadata

  • Download URL: iam_watching-1.5.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/23.6.0

File hashes

Hashes for iam_watching-1.5.0.tar.gz
Algorithm Hash digest
SHA256 ae3b84394f79406b479c28c85b52f9eebe16e3982c4258e170afdea6e3c0d9cd
MD5 ec34fe472d77cab19689bc65607e90a4
BLAKE2b-256 8aaf12c87dca8b64f05054ce44fa44d0828932b1caf889e72d4d630b8959b25e

See more details on using hashes here.

File details

Details for the file iam_watching-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: iam_watching-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/23.6.0

File hashes

Hashes for iam_watching-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a461218938402da961688f8e3609794f56e3d9c525c848ad1d1ff5a242cede4
MD5 36f6c661bbae47eb73c4cc7c71be5202
BLAKE2b-256 41faa4b93105854c05ad7a6b33c624a236a5303255472125b89090cd27d96972

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