aws-cdk-lib
Version 2 of the AWS Cloud Development Kit library
What it is and what it does
aws-cdk-lib is the core construct library for AWS CDK v2, a framework for defining cloud infrastructure in Python code rather than CloudFormation templates directly. It provides high-level abstractions (constructs) that map to AWS resources and services, letting you organize deployments into Stacks (physical CloudFormation units) and Stages (logical application instances). The library handles synthesis—converting your Python definitions into CloudFormation JSON—and manages asset handling, role configuration, and deployment orchestration through pluggable synthesizers.
You write Python classes that inherit from Stack, instantiate constructs for the AWS resources you need, and then synthesize and deploy. It supports both classic and barrel imports for different coding styles. The package depends on constructs (the base abstraction layer), jsii (for language bindings), and AWS CDK asset packages for CLI and Node.js tooling integration.
Use it for:
- Define multi-environment deployments by instantiating the same Stack class with different configurations for dev, staging, and production.
- Build reusable infrastructure libraries as construct subclasses that teams can share across projects.
- Manage complex infrastructure organized across multiple stacks without writing raw CloudFormation.
- Automate infrastructure changes through version control and CI/CD pipelines using Python code review workflows.
- Separate stateful and stateless resources into different stacks for independent lifecycle management.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides Python APIs to define and deploy AWS cloud infrastructure as code, organizing resources into stacks and stages that synthesize to CloudFormation.
Yes. aws-cdk-lib is production-stable (Development Status 5), actively maintained with recent updates, has no known vulnerabilities, and low installation friction. It is the standard library for Python-based AWS CDK v2 projects. Install it if you are building infrastructure-as-code applications on AWS and prefer Python over CloudFormation templates.
Install
aws-cdk-lib on PyPI
pip
pip install aws-cdk-libuv
uv add aws-cdk-libpoetry
poetry add aws-cdk-libInstalling aws-cdk-lib
Before you install
Low friction installation with a pure-Python wheel. Actively maintained with a recent release (1 day old) and 12868 repository stars. Requires Python 3.10 or later.
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions.
Quickstart
pip install aws-cdk-lib constructs
from aws_cdk import Stack, App
from aws_cdk import aws_s3 as s3
app = App()
stack = Stack(app, "MyStack")
s3.Bucket(stack, "MyBucket")
Requires Python 3.10 or later; AWS credentials and bootstrap configuration needed for actual deployment.
Verify before relying
- Whether the package handles all AWS service APIs or if some require separate modules.
- Performance characteristics when synthesizing large stacks with hundreds of resources.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — aws-cdk.asset-awscli-v1, aws-cdk.asset-node-proxy-agent-v6, aws-cdk.cloud-assembly-schema, constructs, jsii, publication |
| Maintenance | actively maintained — 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 7,577,580/month — #1,721 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: aws_cdk_lib-2.265.0-py3-none-any.whl
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
aws-cdk.aws-s3Defines AWS S3 buckets and related resources as…
permissive · top 15,000 on PyPI
aws-cdk.coreProvides the core construct classes and stack…
permissive · top 15,000 on PyPI
aws-cdk.aws-cloudformationDefines AWS CloudFormation resources…
permissive · top 15,000 on PyPI
cdk8scdk8s is a framework for defining Kubernetes…
permissive · top 15,000 on PyPI
aws-cdk.aws-apigatewayProvides AWS CDK constructs for defining and…
permissive · top 15,000 on PyPI
cdk-aurora-globaldatabaseProvides AWS CDK constructs to deploy Amazon…
permissive · top 15,000 on PyPI
sceptreSceptre automates AWS CloudFormation stack…
permissive · top 15,000 on PyPI
aws-cdk.custom-resourcesProvides a framework for implementing AWS…
permissive · top 15,000 on PyPI
aws-cdk.assetsProvides Python bindings for AWS CDK asset…
permissive · top 15,000 on PyPI
constructsConstructs is a programming model for defining…
permissive · top 5,000 on PyPI