delete 2 Or more!
Note
d2O is a small CLI that audits your AWS IAM customer-managed policies and reports two things:
- Unused policies - policies not attached to any principal and not used as a permissions boundary (attachment count and permissions-boundary usage count are both
0). - Policies with multiple versions - non-default versions that exist alongside the active one. IAM allows at most 5 versions per managed policy, stale versions are a security risk as they may hold higher permissions than the current default.
$ ./d2O -h
Usage of d2O:
-region string
AWS region used for IAM communication (default "eu-west-1")
-verbose
verbose log output
-version
show version# via the Go toolchain
go install github.com/wakeful/d2OYou can download a pre-built binary from the release page and add it to your user PATH.
Let's run d2O against the current AWS account.
$ d2O | tee outputWe should get back a similar response.
{
"unused": [
"arn:aws:iam::CurrentAccountID:policy/test-admin",
],
"withVersions": {
"arn:aws:iam::CurrentAccountID:policy/backup": [
{
"createDate": "2026-04-08T18:42:00Z",
"versionID": "v3"
},
{
"createDate": "2026-04-08T18:24:00Z",
"versionID": "v1"
}
]
}
}