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 -u testuser
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.
Using It
poetry install
poetry run iam_watching --user [iam_username]|[role_session_name]
Publishing the Package
# Build & install locally
poetry build
pipx install dist/iam_watching-1.1.0-py3-none-any.whl --force
# Run locally
iam_watching --help
TODO
- Publish to pypy
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
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_watching-1.2.0.tar.gz.
File metadata
- Download URL: iam_watching-1.2.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/23.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed295161c6e5d42dfecb785f50ea1052eae1b093efd109b98634626a1701e87d
|
|
| MD5 |
64a460df26b05eeb99c67033db38e8ca
|
|
| BLAKE2b-256 |
6832589874c2f12feff82b32e9667adaad3638ca8b3c50e4c2d501cfe37ec390
|
File details
Details for the file iam_watching-1.2.0-py3-none-any.whl.
File metadata
- Download URL: iam_watching-1.2.0-py3-none-any.whl
- Upload date:
- Size: 4.2 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c6281bec39594122ccfcc351f8a2ebf5545e6d1238ccce8e7effec9d7f2cd22
|
|
| MD5 |
42bbf5deeca3cade1867fdb35c93f491
|
|
| BLAKE2b-256 |
592610cc7cd9931870a6567e10651851b231e95413adaef095b16fc571eb6d69
|