Registry / aws / cdktf-cdktf-provider-aws

cdktf-cdktf-provider-aws

JSON →
library21.22.1pypypiunverified

The `cdktf-cdktf-provider-aws` library provides a Pythonic interface to the AWS Terraform provider within the Cloud Development Kit for Terraform (CDKTF) ecosystem. It allows users to define AWS infrastructure using familiar Python constructs, which CDKTF then synthesizes into Terraform HCL for deployment. This library, currently at version 21.22.1, is updated frequently to reflect new versions of the underlying AWS Terraform provider and the `cdktf` core library.

pip install cdktf-cdktf-provider-aws
INSTALL
IMPORT
SIG · CDKTF-CDKTF-PROVID
C
cdktf-cdktf-provider-aws
awspythonv21.22.1
Install
23.8s avg
Import
—
Disk
470MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v21.22.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 397.7MB
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 23.8s · import 0.000s · 398MB
470MB installed
● package 470MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AwsProvider
✓ from cdktf_cdktf_provider_aws.provider import AwsProvider
✗ from cdktf_aws import AwsProvider
The generated Python package uses `cdktf_cdktf_provider_aws` as its root namespace.
S3Bucket
✓ from cdktf_cdktf_provider_aws.s3_bucket import S3Bucket
✗ from cdktf_cdktf_provider_aws.s3 import S3Bucket
Each Terraform resource type typically resides in its own module named after the resource (e.g., `s3_bucket.py`).

This quickstart defines a `TerraformStack` that provisions a simple AWS S3 bucket using the `cdktf-cdktf-provider-aws` library. It configures the AWS provider and creates an S3 bucket with a unique prefix and tags. The bucket's domain name is then exported as a Terraform output. Ensure `AWS_REGION`, `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY` environment variables are set for deployment, or configure them via other AWS credential methods. After running `python main.py` (assuming the code is in `main.py`), use `cdktf deploy my-cdktf-aws-stack` to provision the resources.

from constructs import Construct from cdktf import App, TerraformStack, TerraformOutput from cdktf_cdktf_provider_aws.provider import AwsProvider from cdktf_cdktf_provider_aws.s3_bucket import S3Bucket import os class MyAwsStack(TerraformStack): def __init__(self, scope: Construct, id: str): super().__init__(scope, id) # Configure AWS Provider AwsProvider(self, "AWS", region=os.environ.get('AWS_REGION', 'us-east-1'), access_key=os.environ.get('AWS_ACCESS_KEY_ID', ''), secret_key=os.environ.get('AWS_SECRET_ACCESS_KEY', '')) # Create an S3 Bucket bucket = S3Bucket(self, "my-cdktf-unique-bucket", bucket_prefix="my-cdktf-prefix-", acl="private", tags={ "Environment": "Development", "Project": "CDKTF-Demo" }) # Output the bucket name TerraformOutput(self, "bucket_name", value=bucket.bucket_domain_name, description="The domain name of the created S3 bucket") app = App() MyAwsStack(app, "my-cdktf-aws-stack") app.synth() # To deploy, run: cdktf deploy my-cdktf-aws-stack
cdktf --version
Debug
Known issues
breakingProvider regeneration (breaking changes in underlying Terraform AWS provider). The `cdktf-cdktf-provider-aws` library is a generated wrapper around the official Terraform AWS provider. When the upstream Terraform AWS provider introduces significant changes, or when the `cdktf` core library is updated, the provider library is regenerated. This can lead to breaking changes in resource attributes, arguments, or behavior.
fix
Refer to the `cdktf` and Terraform AWS provider release notes. Upgrade `cdktf-cdktf-provider-aws` and `cdktf` to compatible versions, reviewing changelogs for attribute name changes or type changes. Use `cdktf diff` before `cdktf deploy` to see proposed changes.
affects: All versions, especially when upgrading `cdktf-cdktf-provider-aws` or `cdktf` across major/minor versions.
gotchaTerraform Provider versioning. `cdktf-cdktf-provider-aws` bundles a specific version of the Terraform AWS provider. If you need a different provider version (e.g., for a new AWS feature, bug fix, or to align with other Terraform configurations) or run into conflicts, you might need to manually configure provider requirements.
fix
Check the `cdktf-cdktf-provider-aws` changelog or documentation for the bundled Terraform provider version. If necessary, you can override the provider version in your `cdktf.json` by adding `terraform.required_providers` for `aws`, but ensure compatibility with your installed `cdktf-cdktf-provider-aws` version.
affects: All versions.
gotchaPython version compatibility. The `cdktf-cdktf-provider-aws` library specifically requires Python `~=3.9`. Using an incompatible Python version (e.g., Python 3.8 or lower, or potentially Python 4.x in the future) will lead to installation failures or runtime errors.
fix
Ensure your development environment uses Python 3.9 or a newer version (e.g., 3.10, 3.11, 3.12). Using `pyenv` or `conda` can help manage multiple Python versions and virtual environments.
affects: All versions.
Upgrade
Version history
21.22.1latest on PyPI · released Dec 10, 2025
Audit
Dependencies
cdktfrequiredRequired to define and synthesize Terraform configurations.
constructsrequiredCore dependency for CDKTF's construct-based architecture.
Agent activity
24 hits · last 30 days
node
24
Resources
cdktf-cdktf-provider-aws — pip install cdktf-cdktf-provider-aws · libregistry