Skip to main content

AWS Infrastructure with CDKTF (Python)

This project uses the Cloud Development Kit for Terraform (CDKTF) with Python to define and deploy AWS infrastructure using named AWS profiles via ~/.aws/credentials and ~/.aws/config.


✅ Prerequisites

1. Install Required Tools

Make sure the following tools are installed:

  • Node.js (v16 or later)
  • npm
  • Terraform CLI
  • Python 3.7+
  • AWS CLI

macOS Example:

brew install node
brew install terraform
brew install python
brew install awscli

2. Install CDKTF CLI

npm install -g cdktf-cli

3a. Configure AWS CLI (Option 1 - Use AWS Provided Tooling)

aws configure --profile myprofile

This creates or updates the following files:

~/.aws/credentials:

[myprofile]
aws_access_key_id=YOUR_ACCESS_KEY
aws_secret_access_key=YOUR_SECRET_KEY

~/.aws/config:

[profile myprofile]
region=us-west-2
output=json

3b. Configure AWS CLI (Option 2 - Use Open Source AWS Login - Recommended)

3b - 1. Clone the code repo from Fahad Zain Jawaid

git clone https://github.com/fahadzainjawaid/awsIdentityTools

You can follow the ReadMe on the repo above to get latest usage and setup guides.


🚀 Getting Started

1. Install the package

pip install pip install BBAWSLightsailMiniV1a

2. Set Up Python Environment & Install Dependencies

python3 -m venv .venv
source .venv/bin/activate
export PIPENV_VERBOSITY=-1
pip install -r requirements.txt

3. Install AWS Provider Bindings

cdktf get

4. Synthesize Terraform Configuration

cdktf synth

5. Review the Plan

cdktf plan

6. Deploy the Infrastructure

cdktf deploy

7. Destroy the Infrastructure (if needed)

cdktf destroy

🛠 Useful Commands

Command Description
cdktf get Install provider bindings
cdktf synth Generate Terraform JSON config
cdktf plan Preview planned changes
cdktf deploy Deploy infrastructure to AWS
cdktf destroy Destroy deployed infrastructure

📁 .gitignore Suggestions

.venv/
cdktf.out/
.terraform/
__pycache__/
*.pyc

📝 Notes

  • To install additional Python packages:

    pip install <package>
    pip freeze > requirements.txt
    
  • To suppress pipenv verbosity in environments where pipenv is used:

    export PIPENV_VERBOSITY=-1
    

📚 References

Metadata

Release files for BBAWSLightsailMiniV1a 0.332.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for BBAWSLightsailMiniV1a 0.332.1
File Size Uploaded
bbawslightsailminiv1a-0.332.1.tar.gz 19.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for BBAWSLightsailMiniV1a 0.332.1
File Interpreter ABI Platform
bbawslightsailminiv1a-0.332.1-py3-none-any.whl Python 3 none any Details

Total release size: 40.3 kB

Release files / bbawslightsailminiv1a-0.332.1.tar.gz

Download URL bbawslightsailminiv1a-0.332.1.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
85ce38ceddf141676b0b872d8e174c0080d5bba933e47c602c4440bf4553aae7
BLAKE2b-256 checksum
How to use checksums
7cd0d4b5508db9f4d6a9a1627f2bd23039b4505242cf05bcdf471cdaaad2fa3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.14.0

Release files / bbawslightsailminiv1a-0.332.1-py3-none-any.whl

Download URL bbawslightsailminiv1a-0.332.1-py3-none-any.whl
Size 20.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
937606d1513d87f7f907b12cf572003a0ed39dbd60bdf3c4a6b88f6152595981
BLAKE2b-256 checksum
How to use checksums
b85127e389cc55e5071f0eb00aa7cc1e2f7ce1ee0f408f5efab2d26df3f41095
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.332.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page