policy-sentry
Generate locked-down AWS IAM Policies
What it is and what it does
Policy Sentry is a command-line tool and Python library that generates AWS IAM policies by mapping resource ARNs and access levels (Read, Write, List, Tagging, Permissions Management) to the specific IAM actions that support them. Instead of manually reviewing AWS documentation and writing policy JSON, you describe what resources you need access to and at what level, and the tool outputs a complete, least-privilege policy statement. It maintains an internal database of AWS actions, their access levels, and supported resource types, then queries that database to produce policies scoped to exactly what you specify.
The tool is designed for infrastructure-as-code developers and security teams who want to enforce least-privilege principles without the tedium of hand-crafting policies. It supports both CLI workflows (create templates, fill in ARNs, generate policies) and Python library usage for programmatic policy generation. The package depends on click for CLI handling, beautifulsoup4 and requests for fetching AWS documentation, orjson for fast JSON serialization, pyyaml for template parsing, and schema for validation.
Use it for:
- Generate least-privilege IAM policies for Lambda functions, EC2 roles, or service accounts by specifying only the resources and access levels needed.
- Automate policy creation in CI/CD pipelines to enforce security standards without manual policy review bottlenecks.
- Create CRUD-based policy templates for teams unfamiliar with AWS IAM action names and resource constraints.
- Reduce policy blast radius in breach scenarios by ensuring roles have only the minimum permissions required.
- Validate or regenerate existing IAM policies to ensure they follow least-privilege principles.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Policy Sentry generates least-privilege AWS IAM policies from resource ARNs and access levels, automating the creation of security-scoped policies that would otherwise require manual AWS documentation review.
Yes. Policy Sentry is actively maintained, has no known vulnerabilities, low install friction, and solves a real security problem—automating least-privilege IAM policy generation. It's appropriate for teams that want to enforce security best practices without manual AWS documentation review. The MIT license and broad Python version support (3.10–3.14) make it suitable for most environments.
Install
policy-sentry on PyPI
pip
pip install policy-sentryuv
uv add policy-sentrypoetry
poetry add policy-sentryInstalling policy-sentry
Before you install
Low install friction with a pure Python wheel and six common dependencies. The package is actively maintained with recent releases, supports current Python versions (3.10–3.14), and has been in development since 2019 with steady community engagement.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install policy_sentry
# Create a CRUD template
policy_sentry create-template --output-file crud.yml --template-type crud
# Edit crud.yml with your ARNs, then generate policy
policy_sentry write-policy --input-file crud.yml
Requires Python 3.10 or later; AWS IAM knowledge helpful but the tool abstracts most complexity.
Verify before relying
- Whether the embedded AWS IAM action database is kept current with new AWS services and actions.
- Performance characteristics when processing large numbers of ARNs or complex access-level combinations.
- Integration points with existing IaC workflows (Terraform, CloudFormation) beyond what the description mentions.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — beautifulsoup4, click, orjson, pyyaml, requests, schema |
| Maintenance | actively maintained — 122 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,637,897/month — #2,267 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: policy_sentry-0.15.2-py3-none-any.whl
Keywords: aws, iam, policies, policy, privileges, roles, security
Tags
More Security packages
Provides Python bindings to the FreeDesktop.org…
permissive · top 1,000 on PyPI
msalMSAL for Python handles OAuth2 and OpenID…
permissive · top 1,000 on PyPI
joserfcjoserfc implements JOSE standards (JWS, JWE,…
permissive · top 1,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
argon2-cffi-bindingsProvides low-level CFFI bindings to the…
permissive · top 1,000 on PyPI
adalADAL for Python authenticates applications with…
permissive · top 1,000 on PyPI
awacsawacs generates AWS IAM policy JSON from Python…
permissive · top 15,000 on PyPI
cloudsplainingCloudsplaining scans AWS IAM policies to…
permissive · top 5,000 on PyPI
policyuniverseParses and analyzes AWS IAM and Resource…
permissive · top 15,000 on PyPI
aws-cdk.aws-iamProvides Python constructs for defining AWS IAM…
permissive · top 15,000 on PyPI
py-iam-expandExpands and deobfuscates AWS IAM action…
permissive · top 15,000 on PyPI
kappaKappa is a command-line tool that automates the…
permissive · top 15,000 on PyPI
cedarpycedarpy binds the Cedar Policy authorization…
unclear · top 15,000 on PyPI
sentry-cliA command-line tool for interacting with…
permissive · top 15,000 on PyPI
aws-cdk.aws-secretsmanagerAWS CDK construct library for provisioning and…
permissive · top 15,000 on PyPI
arnParses AWS ARN strings into typed objects with…
unclear · top 15,000 on PyPI