cli_cmd¶
AWS CDK CLI Command Wrapper Classes
This module provides a class-based approach to AWS CDK CLI commands (bootstrap, synth, deploy, destroy, etc.) with comprehensive option handling and flexible execution support.
# Deploy a stack with options
Deploy(
stacks=["MyStack"],
profile="my_aws_profile",
require_approval="never"
).run()
# Destroy a stack with confirmation bypass
Destroy(
stacks=["MyStack"],
force=True
).run()
- class cdk_mate.cli.cli_cmd.BaseCommand(app: str = OPT, asset_metadata: bool = OPT, builder: str = OPT, ca_bundle_path: str = OPT, ci: bool = OPT, context: dict[str, str] = OPT, debug: bool = OPT, ec2creds: bool = OPT, help: bool = OPT, ignore_errors: bool = OPT, json: bool = OPT, lookups: bool = OPT, no_color: bool = OPT, notices: bool = OPT, output: str = OPT, path_metadata: bool = OPT, plugin: list[str] = OPT, profile: str = OPT, proxy: str = OPT, role_arn: str = OPT, staging: bool = OPT, strict: bool = OPT, trace: bool = OPT, verbose: int = OPT, version: bool = OPT, version_reporting: bool = OPT)[source]¶
Base class for all CDK CLI commands.
Implements common functionality for command execution:
Parameter validation
Argument processing and conversion
Command execution with AWS session integration
All CDK commands inherit global options from this class, such as:
AWS profile and credentials management
Output formatting
Debug and verbose options
And many other global AWS CDK CLI options
The class uses a metadata-driven approach to process different argument types, allowing for a clean, declarative command definition.
- run(bsm: BotoSesManager | None = None, dir_cdk: T_PATH_ARG | None = None)[source]¶
Execute the CDK command with the configured parameters.
- Parameters:
bsm – Optional Boto Session Manager for AWS credentials and context
dir_cdk – Optional directory path for executing the CDK command
- Returns:
CompletedProcess instance with command execution results
- Raises:
subprocess.CalledProcessError – If the command execution fails
- class cdk_mate.cli.cli_cmd.Acknowledge(app: str = OPT, asset_metadata: bool = OPT, builder: str = OPT, ca_bundle_path: str = OPT, ci: bool = OPT, context: dict[str, str] = OPT, debug: bool = OPT, ec2creds: bool = OPT, help: bool = OPT, ignore_errors: bool = OPT, json: bool = OPT, lookups: bool = OPT, no_color: bool = OPT, notices: bool = OPT, output: str = OPT, path_metadata: bool = OPT, plugin: list[str] = OPT, profile: str = OPT, proxy: str = OPT, role_arn: str = OPT, staging: bool = OPT, strict: bool = OPT, trace: bool = OPT, verbose: int = OPT, version: bool = OPT, version_reporting: bool = OPT, notice_id: str = OPT)[source]¶
Acknowledge a notice by issue number and hide it from displaying again.
Ref: https://docs.aws.amazon.com/cdk/v2/guide/ref-cli-cmd-ack.html
- class cdk_mate.cli.cli_cmd.Bootstrap(app: str = OPT, asset_metadata: bool = OPT, builder: str = OPT, ca_bundle_path: str = OPT, ci: bool = OPT, context: dict[str, str] = OPT, debug: bool = OPT, ec2creds: bool = OPT, help: bool = OPT, ignore_errors: bool = OPT, json: bool = OPT, lookups: bool = OPT, no_color: bool = OPT, notices: bool = OPT, output: str = OPT, path_metadata: bool = OPT, plugin: list[str] = OPT, profile: str = OPT, proxy: str = OPT, role_arn: str = OPT, staging: bool = OPT, strict: bool = OPT, trace: bool = OPT, verbose: int = OPT, version: bool = OPT, version_reporting: bool = OPT, aws_environment: str = OPT, bootstrap_bucket_name: str = OPT, bootstrap_customer_key: bool = OPT, bootstrap_kms_key_id: str = OPT, cloudformation_execution_policies: list[str] = OPT, custom_permissions_boundary: str = OPT, example_permissions_boundary: bool = OPT, execute: bool = OPT, force: bool = OPT, previous_parameters: bool = OPT, public_access_block_configuration: bool = OPT, qualifier: str = OPT, show_template: bool = OPT, tags: dict[str, str] = OPT, template: str = OPT, termination_protection: bool = OPT, toolkit_stack_name: str = OPT, trust: list[str] = OPT, trust_for_lookup: list[str] = OPT)[source]¶
Prepare an AWS environment for CDK deployments by deploying the CDK bootstrap stack, named
CDKToolkit, into the AWS environment.Ref: https://docs.aws.amazon.com/cdk/v2/guide/ref-cli-cmd-bootstrap.html
- class cdk_mate.cli.cli_cmd.Context(app: str = OPT, asset_metadata: bool = OPT, builder: str = OPT, ca_bundle_path: str = OPT, ci: bool = OPT, context: dict[str, str] = OPT, debug: bool = OPT, ec2creds: bool = OPT, help: bool = OPT, ignore_errors: bool = OPT, json: bool = OPT, lookups: bool = OPT, no_color: bool = OPT, notices: bool = OPT, output: str = OPT, path_metadata: bool = OPT, plugin: list[str] = OPT, profile: str = OPT, proxy: str = OPT, role_arn: str = OPT, staging: bool = OPT, strict: bool = OPT, trace: bool = OPT, verbose: int = OPT, version: bool = OPT, version_reporting: bool = OPT, clear: bool = OPT, force: bool = OPT, reset: str = OPT)[source]¶
Manage cached context values for your AWS CDK application.
Ref: https://docs.aws.amazon.com/cdk/v2/guide/ref-cli-cmd-context.html
- class cdk_mate.cli.cli_cmd.Deploy(app: str = OPT, asset_metadata: bool = OPT, builder: str = OPT, ca_bundle_path: str = OPT, ci: bool = OPT, context: dict[str, str] = OPT, debug: bool = OPT, ec2creds: bool = OPT, help: bool = OPT, ignore_errors: bool = OPT, json: bool = OPT, lookups: bool = OPT, no_color: bool = OPT, notices: bool = OPT, output: str = OPT, path_metadata: bool = OPT, plugin: list[str] = OPT, profile: str = OPT, proxy: str = OPT, role_arn: str = OPT, staging: bool = OPT, strict: bool = OPT, trace: bool = OPT, verbose: int = OPT, version: bool = OPT, version_reporting: bool = OPT, stacks: list[str] = OPT, all: bool = OPT, asset_parallelism: bool = OPT, asset_prebuild: bool = OPT, build_exclude: list[str] = OPT, change_set_name: str = OPT, concurrency: int = OPT, exclusively: bool = OPT, force: bool = OPT, hotswap: bool = OPT, hotswap_fallback: bool = OPT, ignore_no_stacks: bool = OPT, import_existing_resources: bool = OPT, logs: bool = OPT, method: str = OPT, notification_arns: list[str] = OPT, outputs_file: str = OPT, parameters: dict[str, str] = OPT, previous_parameters: bool = OPT, progress: str = OPT, require_approval: str = OPT, rollback: bool | None = None, toolkit_stack_name: str = OPT, watch: bool = OPT)[source]¶
Deploy AWS CDK stacks to AWS infrastructure with granular control over deployment parameters.
Ref: https://docs.aws.amazon.com/cdk/v2/guide/ref-cli-cmd-deploy.html
- class cdk_mate.cli.cli_cmd.Destroy(app: str = OPT, asset_metadata: bool = OPT, builder: str = OPT, ca_bundle_path: str = OPT, ci: bool = OPT, context: dict[str, str] = OPT, debug: bool = OPT, ec2creds: bool = OPT, help: bool = OPT, ignore_errors: bool = OPT, json: bool = OPT, lookups: bool = OPT, no_color: bool = OPT, notices: bool = OPT, output: str = OPT, path_metadata: bool = OPT, plugin: list[str] = OPT, profile: str = OPT, proxy: str = OPT, role_arn: str = OPT, staging: bool = OPT, strict: bool = OPT, trace: bool = OPT, verbose: int = OPT, version: bool = OPT, version_reporting: bool = OPT, stacks: list[str] = OPT, all: bool = OPT, exclusively: bool = OPT, force: bool = OPT)[source]¶
Safely remove AWS CDK stacks from infrastructure with flexible destruction options.
Ref: https://docs.aws.amazon.com/cdk/v2/guide/ref-cli-cmd-deploy.html
- class cdk_mate.cli.cli_cmd.Diff(app: str = OPT, asset_metadata: bool = OPT, builder: str = OPT, ca_bundle_path: str = OPT, ci: bool = OPT, context: dict[str, str] = OPT, debug: bool = OPT, ec2creds: bool = OPT, help: bool = OPT, ignore_errors: bool = OPT, json: bool = OPT, lookups: bool = OPT, no_color: bool = OPT, notices: bool = OPT, output: str = OPT, path_metadata: bool = OPT, plugin: list[str] = OPT, profile: str = OPT, proxy: str = OPT, role_arn: str = OPT, staging: bool = OPT, strict: bool = OPT, trace: bool = OPT, verbose: int = OPT, version: bool = OPT, version_reporting: bool = OPT, stacks: list[str] = OPT, change_set: bool = OPT, context_lines: int = OPT, exclusively: bool = OPT, fail: bool = OPT, processed: bool = OPT, quiet: bool = OPT, security_only: bool = OPT, template: str = OPT)[source]¶
Compare deployed stacks with current state or a specific CloudFormation template.
Ref: https://docs.aws.amazon.com/cdk/v2/guide/ref-cli-cmd-diff.html
- class cdk_mate.cli.cli_cmd.GC(app: str = OPT, asset_metadata: bool = OPT, builder: str = OPT, ca_bundle_path: str = OPT, ci: bool = OPT, context: dict[str, str] = OPT, debug: bool = OPT, ec2creds: bool = OPT, help: bool = OPT, ignore_errors: bool = OPT, json: bool = OPT, lookups: bool = OPT, no_color: bool = OPT, notices: bool = OPT, output: str = OPT, path_metadata: bool = OPT, plugin: list[str] = OPT, profile: str = OPT, proxy: str = OPT, role_arn: str = OPT, staging: bool = OPT, strict: bool = OPT, trace: bool = OPT, verbose: int = OPT, version: bool = OPT, version_reporting: bool = OPT, aws_environment: list[str] = OPT, action: str = OPT, bootstrap_stack_name: str = OPT, confirm: bool = OPT, created_buffer_days: int = OPT, rollback_buffer_days: int = OPT, type: str = OPT, unstable: list[str] = OPT)[source]¶
Perform garbage collection on unused assets stored in the resources of your bootstrap stack.
Note: This command is still in development and requires the –unstable=gc option.
Ref: https://docs.aws.amazon.com/cdk/v2/guide/ref-cli-cmd-gc.html
- class cdk_mate.cli.cli_cmd.Import(app: str = OPT, asset_metadata: bool = OPT, builder: str = OPT, ca_bundle_path: str = OPT, ci: bool = OPT, context: dict[str, str] = OPT, debug: bool = OPT, ec2creds: bool = OPT, help: bool = OPT, ignore_errors: bool = OPT, json: bool = OPT, lookups: bool = OPT, no_color: bool = OPT, notices: bool = OPT, output: str = OPT, path_metadata: bool = OPT, plugin: list[str] = OPT, profile: str = OPT, proxy: str = OPT, role_arn: str = OPT, staging: bool = OPT, strict: bool = OPT, trace: bool = OPT, verbose: int = OPT, version: bool = OPT, version_reporting: bool = OPT, stacks: list[str] = OPT, change_set_name: str = OPT, execute: bool = OPT, force: bool = OPT, record_resource_mapping: str = OPT, resource_mapping: str = OPT, rollback: bool | None = None, toolkit_stack_name: str = OPT)[source]¶
Import existing AWS resources into a CDK stack.
This command allows you to take existing resources that were created using other methods and start managing them using the AWS CDK.
Ref: https://docs.aws.amazon.com/cdk/v2/guide/ref-cli-cmd-import.html
- class cdk_mate.cli.cli_cmd.Init(app: str = OPT, asset_metadata: bool = OPT, builder: str = OPT, ca_bundle_path: str = OPT, ci: bool = OPT, context: dict[str, str] = OPT, debug: bool = OPT, ec2creds: bool = OPT, help: bool = OPT, ignore_errors: bool = OPT, json: bool = OPT, lookups: bool = OPT, no_color: bool = OPT, notices: bool = OPT, output: str = OPT, path_metadata: bool = OPT, plugin: list[str] = OPT, profile: str = OPT, proxy: str = OPT, role_arn: str = OPT, staging: bool = OPT, strict: bool = OPT, trace: bool = OPT, verbose: int = OPT, version: bool = OPT, version_reporting: bool = OPT, template_type: str = OPT, generate_only: bool = OPT, language: str = OPT, list_: bool = OPT)[source]¶
Create a new AWS CDK project from a template.
Ref: https://docs.aws.amazon.com/cdk/v2/guide/ref-cli-cmd-init.html
- class cdk_mate.cli.cli_cmd.Synth(app: str = OPT, asset_metadata: bool = OPT, builder: str = OPT, ca_bundle_path: str = OPT, ci: bool = OPT, context: dict[str, str] = OPT, debug: bool = OPT, ec2creds: bool = OPT, help: bool = OPT, ignore_errors: bool = OPT, json: bool = OPT, lookups: bool = OPT, no_color: bool = OPT, notices: bool = OPT, output: str = OPT, path_metadata: bool = OPT, plugin: list[str] = OPT, profile: str = OPT, proxy: str = OPT, role_arn: str = OPT, staging: bool = OPT, strict: bool = OPT, trace: bool = OPT, verbose: int = OPT, version: bool = OPT, version_reporting: bool = OPT, exclusively: bool = OPT, quiet: bool = OPT, validation: bool = OPT)[source]¶
Synthesize AWS CDK stacks into CloudFormation templates with comprehensive configuration options.
Ref: https://docs.aws.amazon.com/cdk/v2/guide/ref-cli-cmd-synth.html