cdk-nag
Check CDK v2 applications for best practices using a combination on available rule packs.
What it is and what it does
cdk-nag is a linting and compliance-checking tool for CDK applications and CloudFormation templates. It runs predefined rule packs—including AWS Solutions best practices, HIPAA security, NIST 800-53 revisions 4 and 5, PCI DSS 3.2.1, and Serverless patterns—to detect security misconfigurations and compliance gaps in infrastructure code. The tool integrates into validation frameworks, allowing you to suppress specific violations on individual constructs or stacks with inline acknowledgments and audit trails.
The package depends on aws-cdk-lib, constructs, jsii, and publication. It supports Python 3.10 through 3.14 and is actively maintained. Violations are reported in a policy-validation-report.json file in the cloud assembly, with optional CloudFormation metadata integration for compatibility with existing compliance tooling.
Use it for:
- Enforce best practices across CDK applications before synthesis or deployment.
- Validate infrastructure code against regulatory frameworks during CI/CD pipelines.
- Suppress known violations on specific resources with documented reasons for audit compliance.
- Scan CloudFormation templates directly for security and compliance issues.
- Integrate compliance checking into synthesis pipelines to catch violations early.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Scans AWS CDK applications and CloudFormation templates against predefined rule packs to identify security and compliance violations.
Yes. cdk-nag is actively maintained, has no known vulnerabilities, low install friction, and provides essential compliance and security scanning for CDK users. The permissive Apache-2.0 license poses no restrictions. Install it if you use CDK and need to enforce security or compliance standards.
Install
cdk-nag on PyPI
pip
pip install cdk-naguv
uv add cdk-nagpoetry
poetry add cdk-nagInstalling cdk-nag
Before you install
Low install friction with a pure Python wheel distribution. Actively maintained with recent releases and 1032 repository stars.
License in practice
Licensed under Apache-2.0 (permissive), allowing free use, modification, and distribution with minimal restrictions.
Quickstart
pip install cdk-nag
from cdk_nag import AwsSolutionsChecks
from constructs import Construct
Validations.of(app).add_plugins(AwsSolutionsChecks(app))
Requires Python 3.10 or later; aws-cdk-lib and constructs must be installed as runtime dependencies.
Verify before relying
- Whether all rule packs (AWS Solutions, HIPAA, NIST 800-53 rev 4/5, PCI DSS, Serverless) are equally mature or if some are experimental.
- Performance characteristics when scanning large CDK applications or complex CloudFormation templates.
- Specific use cases for the publication runtime dependency.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — aws-cdk-lib, constructs, jsii, publication |
| Maintenance | actively maintained — 10 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,690,555/month — #2,528 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cdk_nag-3.0.2-py3-none-any.whl
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
awslabs.aws-iac-mcp-serverProvides an MCP server that validates…
permissive · top 15,000 on PyPI
ickIck is a polyglot tool for bundling best…
permissive · top 15,000 on PyPI
cloudsec-auditAudits AWS cloud security posture by checking…
permissive · top 15,000 on PyPI
aws-cdk.integ-tests-alphaProvides constructs and utilities for writing…
permissive · top 15,000 on PyPI
compliance-trestleCompliance-trestle manages, validates, and…
permissive · top 15,000 on PyPI
aws-cdk.aws-kmsProvides AWS CDK constructs for defining and…
permissive · top 15,000 on PyPI
aws-cdk.aws-cloudwatchDefines CloudWatch metrics, alarms, and…
permissive · top 15,000 on PyPI
aws-cdk.aws-servicediscoveryProvides AWS CDK constructs for defining and…
permissive · top 15,000 on PyPI
abi3auditabi3audit scans Python extension wheels and…
permissive · top 15,000 on PyPI
prowlerProwler automates security and compliance…
permissive · top 15,000 on PyPI