AwsCdkCli
- class aws_cdk.cli_lib_alpha.AwsCdkCli(*args: Any, **kwargs)
Bases:
object
(experimental) Provides a programmatic interface for interacting with the AWS CDK CLI.
- Stability:
experimental
- ExampleMetadata:
fixture=imports infused
Example:
cli = AwsCdkCli.from_cdk_app_directory("/path/to/cdk/app")
Methods
- bootstrap(*, bootstrap_bucket_name=None, bootstrap_customer_key=None, bootstrap_kms_key_id=None, cfn_execution_policy=None, custom_permissions_boundary=None, environments=None, example_permissions_boundary=None, execute=None, force=None, public_access_block_configuration=None, qualifier=None, show_template=None, template=None, termination_protection=None, toolkit_stack_name=None, trust=None, trust_for_lookup=None, use_previous_parameters=None, asset_metadata=None, ca_bundle_path=None, color=None, context=None, debug=None, ec2_creds=None, ignore_errors=None, json=None, lookups=None, notices=None, path_metadata=None, profile=None, proxy=None, role_arn=None, stacks=None, staging=None, strict=None, trace=None, verbose=None, version_reporting=None)
(experimental) cdk bootstrap.
- Parameters:
bootstrap_bucket_name (
Optional
[str
]) – (experimental) The name of the CDK toolkit bucket; bucket will be created and must not exist Default: - auto-generated CloudFormation namebootstrap_customer_key (
Optional
[str
]) – (experimental) Create a Customer Master Key (CMK) for the bootstrap bucket (you will be charged but can customize permissions, modern bootstrapping only). Default: undefinedbootstrap_kms_key_id (
Optional
[str
]) – (experimental) AWS KMS master key ID used for the SSE-KMS encryption. Default: undefinedcfn_execution_policy (
Optional
[str
]) – (experimental) The Managed Policy ARNs that should be attached to the role performing deployments into this environment (may be repeated, modern bootstrapping only). Default: - nonecustom_permissions_boundary (
Optional
[str
]) – (experimental) Use the permissions boundary specified by name. Default: undefinedenvironments (
Optional
[Sequence
[str
]]) – (experimental) The target AWS environments to deploy the bootstrap stack to. Uses the following format:aws://<account-id>/<region>
Default: - Bootstrap all environments referenced in the CDK app or determine an environment from local configuration.example_permissions_boundary (
Optional
[bool
]) – (experimental) Use the example permissions boundary. Default: undefinedexecute (
Optional
[bool
]) – (experimental) Whether to execute ChangeSet (–no-execute will NOT execute the ChangeSet). Default: trueforce (
Optional
[bool
]) – (experimental) Always bootstrap even if it would downgrade template version. Default: falsepublic_access_block_configuration (
Optional
[str
]) – (experimental) Block public access configuration on CDK toolkit bucket (enabled by default). Default: undefinedqualifier (
Optional
[str
]) – (experimental) String which must be unique for each bootstrap stack. You must configure it on your CDK app if you change this from the default. Default: undefinedshow_template (
Optional
[bool
]) – (experimental) Instead of actual bootstrapping, print the current CLI’s bootstrapping template to stdout for customization. Default: falsetemplate (
Optional
[str
]) – (experimental) Use the template from the given file instead of the built-in one (use –show-template to obtain an example).termination_protection (
Optional
[bool
]) – (experimental) Toggle CloudFormation termination protection on the bootstrap stacks. Default: falsetoolkit_stack_name (
Optional
[str
]) – (experimental) The name of the CDK toolkit stack to create.trust (
Optional
[str
]) – (experimental) The AWS account IDs that should be trusted to perform deployments into this environment (may be repeated, modern bootstrapping only). Default: undefinedtrust_for_lookup (
Optional
[str
]) – (experimental) The AWS account IDs that should be trusted to look up values in this environment (may be repeated, modern bootstrapping only). Default: undefineduse_previous_parameters (
Optional
[bool
]) – (experimental) Use previous values for existing parameters (you must specify all parameters on every deployment if this is disabled). Default: trueasset_metadata (
Optional
[bool
]) – (experimental) Include “aws:asset:*” CloudFormation metadata for resources that use assets. Default: trueca_bundle_path (
Optional
[str
]) – (experimental) Path to CA certificate to use when validating HTTPS requests. Default: - read from AWS_CA_BUNDLE environment variablecolor (
Optional
[bool
]) – (experimental) Show colors and other style from console output. Default: -true
unless the environment variableNO_COLOR
is setcontext (
Optional
[Mapping
[str
,str
]]) – (experimental) Additional context. Default: - no additional contextdebug (
Optional
[bool
]) – (experimental) enable emission of additional debugging information, such as creation stack traces of tokens. Default: falseec2_creds (
Optional
[bool
]) – (experimental) Force trying to fetch EC2 instance credentials. Default: - guess EC2 instance statusignore_errors (
Optional
[bool
]) – (experimental) Ignores synthesis errors, which will likely produce an invalid output. Default: falsejson (
Optional
[bool
]) – (experimental) Use JSON output instead of YAML when templates are printed to STDOUT. Default: falselookups (
Optional
[bool
]) – (experimental) Perform context lookups. Synthesis fails if this is disabled and context lookups need to be performed Default: truenotices (
Optional
[bool
]) – (experimental) Show relevant notices. Default: truepath_metadata (
Optional
[bool
]) – (experimental) Include “aws:cdk:path” CloudFormation metadata for each resource. Default: trueprofile (
Optional
[str
]) – (experimental) Use the indicated AWS profile as the default environment. Default: - no profile is usedproxy (
Optional
[str
]) – (experimental) Use the indicated proxy. Will read from HTTPS_PROXY environment if specified Default: - no proxyrole_arn (
Optional
[str
]) – (experimental) Role to pass to CloudFormation for deployment. Default: - use the bootstrap cfn-exec rolestacks (
Optional
[Sequence
[str
]]) – (experimental) List of stacks to deploy. Default: - all stacksstaging (
Optional
[bool
]) – (experimental) Copy assets to the output directory. Needed for local debugging the source files with SAM CLI Default: falsestrict (
Optional
[bool
]) – (experimental) Do not construct stacks with warnings. Default: falsetrace (
Optional
[bool
]) – (experimental) Print trace for stack warnings. Default: falseverbose (
Optional
[bool
]) – (experimental) show debug logs. Default: falseversion_reporting (
Optional
[bool
]) – (experimental) Include “AWS::CDK::Metadata” resource in synthesized templates. Default: true
- Stability:
experimental
- Return type:
None
- deploy(*, asset_parallelism=None, asset_prebuild=None, change_set_name=None, ci=None, concurrency=None, exclusively=None, execute=None, force=None, hotswap=None, notification_arns=None, outputs_file=None, parameters=None, progress=None, require_approval=None, reuse_assets=None, rollback=None, toolkit_stack_name=None, use_previous_parameters=None, asset_metadata=None, ca_bundle_path=None, color=None, context=None, debug=None, ec2_creds=None, ignore_errors=None, json=None, lookups=None, notices=None, path_metadata=None, profile=None, proxy=None, role_arn=None, stacks=None, staging=None, strict=None, trace=None, verbose=None, version_reporting=None)
(experimental) cdk deploy.
- Parameters:
asset_parallelism (
Optional
[bool
]) – (experimental) Whether to build/publish assets in parallel. Default: falseasset_prebuild (
Optional
[bool
]) – (experimental) Whether to build all assets before deploying the first stack (useful for failing Docker builds). Default: truechange_set_name (
Optional
[str
]) – (experimental) Optional name to use for the CloudFormation change set. If not provided, a name will be generated automatically. Default: - auto generate a nameci (
Optional
[bool
]) – (experimental) Whether we are on a CI system. Default: -false
unless the environment variableCI
is setconcurrency (
Union
[int
,float
,None
]) – (experimental) Maximum number of simultaneous deployments (dependency permitting) to execute. Default: 1exclusively (
Optional
[bool
]) – (experimental) Only perform action on the given stack. Default: falseexecute (
Optional
[bool
]) – (experimental) Whether to execute the ChangeSet Not providingexecute
parameter will result in execution of ChangeSet. Default: trueforce (
Optional
[bool
]) – (experimental) Always deploy, even if templates are identical. Default: falsehotswap (
Optional
[HotswapMode
]) –notification_arns (
Optional
[Sequence
[str
]]) – (experimental) ARNs of SNS topics that CloudFormation will notify with stack related events. Default: - no notificationsoutputs_file (
Optional
[str
]) – (experimental) Path to file where stack outputs will be written after a successful deploy as JSON. Default: - Outputs are not written to any fileparameters (
Optional
[Mapping
[str
,str
]]) – (experimental) Additional parameters for CloudFormation at deploy time. Default: {}progress (
Optional
[StackActivityProgress
]) – (experimental) Display mode for stack activity events. The default in the CLI is StackActivityProgress.BAR. But since this is an API it makes more sense to set the default to StackActivityProgress.EVENTS Default: StackActivityProgress.EVENTSrequire_approval (
Optional
[RequireApproval
]) – (experimental) What kind of security changes require approval. Default: RequireApproval.Neverreuse_assets (
Optional
[Sequence
[str
]]) – (experimental) Reuse the assets with the given asset IDs. Default: - do not reuse assetsrollback (
Optional
[bool
]) – (experimental) Rollback failed deployments. Default: truetoolkit_stack_name (
Optional
[str
]) – (experimental) Name of the toolkit stack to use/deploy. Default: CDKToolkituse_previous_parameters (
Optional
[bool
]) – (experimental) Use previous values for unspecified parameters. If not set, all parameters must be specified for every deployment. Default: trueasset_metadata (
Optional
[bool
]) – (experimental) Include “aws:asset:*” CloudFormation metadata for resources that use assets. Default: trueca_bundle_path (
Optional
[str
]) – (experimental) Path to CA certificate to use when validating HTTPS requests. Default: - read from AWS_CA_BUNDLE environment variablecolor (
Optional
[bool
]) – (experimental) Show colors and other style from console output. Default: -true
unless the environment variableNO_COLOR
is setcontext (
Optional
[Mapping
[str
,str
]]) – (experimental) Additional context. Default: - no additional contextdebug (
Optional
[bool
]) – (experimental) enable emission of additional debugging information, such as creation stack traces of tokens. Default: falseec2_creds (
Optional
[bool
]) – (experimental) Force trying to fetch EC2 instance credentials. Default: - guess EC2 instance statusignore_errors (
Optional
[bool
]) – (experimental) Ignores synthesis errors, which will likely produce an invalid output. Default: falsejson (
Optional
[bool
]) – (experimental) Use JSON output instead of YAML when templates are printed to STDOUT. Default: falselookups (
Optional
[bool
]) – (experimental) Perform context lookups. Synthesis fails if this is disabled and context lookups need to be performed Default: truenotices (
Optional
[bool
]) – (experimental) Show relevant notices. Default: truepath_metadata (
Optional
[bool
]) – (experimental) Include “aws:cdk:path” CloudFormation metadata for each resource. Default: trueprofile (
Optional
[str
]) – (experimental) Use the indicated AWS profile as the default environment. Default: - no profile is usedproxy (
Optional
[str
]) – (experimental) Use the indicated proxy. Will read from HTTPS_PROXY environment if specified Default: - no proxyrole_arn (
Optional
[str
]) – (experimental) Role to pass to CloudFormation for deployment. Default: - use the bootstrap cfn-exec rolestacks (
Optional
[Sequence
[str
]]) – (experimental) List of stacks to deploy. Default: - all stacksstaging (
Optional
[bool
]) – (experimental) Copy assets to the output directory. Needed for local debugging the source files with SAM CLI Default: falsestrict (
Optional
[bool
]) – (experimental) Do not construct stacks with warnings. Default: falsetrace (
Optional
[bool
]) – (experimental) Print trace for stack warnings. Default: falseverbose (
Optional
[bool
]) – (experimental) show debug logs. Default: falseversion_reporting (
Optional
[bool
]) – (experimental) Include “AWS::CDK::Metadata” resource in synthesized templates. Default: true
- Stability:
experimental
- Return type:
None
- destroy(*, exclusively=None, require_approval=None, asset_metadata=None, ca_bundle_path=None, color=None, context=None, debug=None, ec2_creds=None, ignore_errors=None, json=None, lookups=None, notices=None, path_metadata=None, profile=None, proxy=None, role_arn=None, stacks=None, staging=None, strict=None, trace=None, verbose=None, version_reporting=None)
(experimental) cdk destroy.
- Parameters:
exclusively (
Optional
[bool
]) – (experimental) Only destroy the given stack. Default: falserequire_approval (
Optional
[bool
]) – (experimental) Should the script prompt for approval before destroying stacks. Default: falseasset_metadata (
Optional
[bool
]) – (experimental) Include “aws:asset:*” CloudFormation metadata for resources that use assets. Default: trueca_bundle_path (
Optional
[str
]) – (experimental) Path to CA certificate to use when validating HTTPS requests. Default: - read from AWS_CA_BUNDLE environment variablecolor (
Optional
[bool
]) – (experimental) Show colors and other style from console output. Default: -true
unless the environment variableNO_COLOR
is setcontext (
Optional
[Mapping
[str
,str
]]) – (experimental) Additional context. Default: - no additional contextdebug (
Optional
[bool
]) – (experimental) enable emission of additional debugging information, such as creation stack traces of tokens. Default: falseec2_creds (
Optional
[bool
]) – (experimental) Force trying to fetch EC2 instance credentials. Default: - guess EC2 instance statusignore_errors (
Optional
[bool
]) – (experimental) Ignores synthesis errors, which will likely produce an invalid output. Default: falsejson (
Optional
[bool
]) – (experimental) Use JSON output instead of YAML when templates are printed to STDOUT. Default: falselookups (
Optional
[bool
]) – (experimental) Perform context lookups. Synthesis fails if this is disabled and context lookups need to be performed Default: truenotices (
Optional
[bool
]) – (experimental) Show relevant notices. Default: truepath_metadata (
Optional
[bool
]) – (experimental) Include “aws:cdk:path” CloudFormation metadata for each resource. Default: trueprofile (
Optional
[str
]) – (experimental) Use the indicated AWS profile as the default environment. Default: - no profile is usedproxy (
Optional
[str
]) – (experimental) Use the indicated proxy. Will read from HTTPS_PROXY environment if specified Default: - no proxyrole_arn (
Optional
[str
]) – (experimental) Role to pass to CloudFormation for deployment. Default: - use the bootstrap cfn-exec rolestacks (
Optional
[Sequence
[str
]]) – (experimental) List of stacks to deploy. Default: - all stacksstaging (
Optional
[bool
]) – (experimental) Copy assets to the output directory. Needed for local debugging the source files with SAM CLI Default: falsestrict (
Optional
[bool
]) – (experimental) Do not construct stacks with warnings. Default: falsetrace (
Optional
[bool
]) – (experimental) Print trace for stack warnings. Default: falseverbose (
Optional
[bool
]) – (experimental) show debug logs. Default: falseversion_reporting (
Optional
[bool
]) – (experimental) Include “AWS::CDK::Metadata” resource in synthesized templates. Default: true
- Stability:
experimental
- Return type:
None
- list(*, long=None, asset_metadata=None, ca_bundle_path=None, color=None, context=None, debug=None, ec2_creds=None, ignore_errors=None, json=None, lookups=None, notices=None, path_metadata=None, profile=None, proxy=None, role_arn=None, stacks=None, staging=None, strict=None, trace=None, verbose=None, version_reporting=None)
(experimental) cdk list.
- Parameters:
long (
Optional
[bool
]) – (experimental) Display environment information for each stack. Default: falseasset_metadata (
Optional
[bool
]) – (experimental) Include “aws:asset:*” CloudFormation metadata for resources that use assets. Default: trueca_bundle_path (
Optional
[str
]) – (experimental) Path to CA certificate to use when validating HTTPS requests. Default: - read from AWS_CA_BUNDLE environment variablecolor (
Optional
[bool
]) – (experimental) Show colors and other style from console output. Default: -true
unless the environment variableNO_COLOR
is setcontext (
Optional
[Mapping
[str
,str
]]) – (experimental) Additional context. Default: - no additional contextdebug (
Optional
[bool
]) – (experimental) enable emission of additional debugging information, such as creation stack traces of tokens. Default: falseec2_creds (
Optional
[bool
]) – (experimental) Force trying to fetch EC2 instance credentials. Default: - guess EC2 instance statusignore_errors (
Optional
[bool
]) – (experimental) Ignores synthesis errors, which will likely produce an invalid output. Default: falsejson (
Optional
[bool
]) – (experimental) Use JSON output instead of YAML when templates are printed to STDOUT. Default: falselookups (
Optional
[bool
]) – (experimental) Perform context lookups. Synthesis fails if this is disabled and context lookups need to be performed Default: truenotices (
Optional
[bool
]) – (experimental) Show relevant notices. Default: truepath_metadata (
Optional
[bool
]) – (experimental) Include “aws:cdk:path” CloudFormation metadata for each resource. Default: trueprofile (
Optional
[str
]) – (experimental) Use the indicated AWS profile as the default environment. Default: - no profile is usedproxy (
Optional
[str
]) – (experimental) Use the indicated proxy. Will read from HTTPS_PROXY environment if specified Default: - no proxyrole_arn (
Optional
[str
]) – (experimental) Role to pass to CloudFormation for deployment. Default: - use the bootstrap cfn-exec rolestacks (
Optional
[Sequence
[str
]]) – (experimental) List of stacks to deploy. Default: - all stacksstaging (
Optional
[bool
]) – (experimental) Copy assets to the output directory. Needed for local debugging the source files with SAM CLI Default: falsestrict (
Optional
[bool
]) – (experimental) Do not construct stacks with warnings. Default: falsetrace (
Optional
[bool
]) – (experimental) Print trace for stack warnings. Default: falseverbose (
Optional
[bool
]) – (experimental) show debug logs. Default: falseversion_reporting (
Optional
[bool
]) – (experimental) Include “AWS::CDK::Metadata” resource in synthesized templates. Default: true
- Stability:
experimental
- Return type:
None
- synth(*, exclusively=None, quiet=None, validation=None, asset_metadata=None, ca_bundle_path=None, color=None, context=None, debug=None, ec2_creds=None, ignore_errors=None, json=None, lookups=None, notices=None, path_metadata=None, profile=None, proxy=None, role_arn=None, stacks=None, staging=None, strict=None, trace=None, verbose=None, version_reporting=None)
(experimental) cdk synth.
- Parameters:
exclusively (
Optional
[bool
]) – (experimental) Only synthesize the given stack. Default: falsequiet (
Optional
[bool
]) – (experimental) Do not output CloudFormation Template to stdout. Default: false;validation (
Optional
[bool
]) – (experimental) After synthesis, validate stacks with the “validateOnSynth” attribute set (can also be controlled with CDK_VALIDATION). Default: true;asset_metadata (
Optional
[bool
]) – (experimental) Include “aws:asset:*” CloudFormation metadata for resources that use assets. Default: trueca_bundle_path (
Optional
[str
]) – (experimental) Path to CA certificate to use when validating HTTPS requests. Default: - read from AWS_CA_BUNDLE environment variablecolor (
Optional
[bool
]) – (experimental) Show colors and other style from console output. Default: -true
unless the environment variableNO_COLOR
is setcontext (
Optional
[Mapping
[str
,str
]]) – (experimental) Additional context. Default: - no additional contextdebug (
Optional
[bool
]) – (experimental) enable emission of additional debugging information, such as creation stack traces of tokens. Default: falseec2_creds (
Optional
[bool
]) – (experimental) Force trying to fetch EC2 instance credentials. Default: - guess EC2 instance statusignore_errors (
Optional
[bool
]) – (experimental) Ignores synthesis errors, which will likely produce an invalid output. Default: falsejson (
Optional
[bool
]) – (experimental) Use JSON output instead of YAML when templates are printed to STDOUT. Default: falselookups (
Optional
[bool
]) – (experimental) Perform context lookups. Synthesis fails if this is disabled and context lookups need to be performed Default: truenotices (
Optional
[bool
]) – (experimental) Show relevant notices. Default: truepath_metadata (
Optional
[bool
]) – (experimental) Include “aws:cdk:path” CloudFormation metadata for each resource. Default: trueprofile (
Optional
[str
]) – (experimental) Use the indicated AWS profile as the default environment. Default: - no profile is usedproxy (
Optional
[str
]) – (experimental) Use the indicated proxy. Will read from HTTPS_PROXY environment if specified Default: - no proxyrole_arn (
Optional
[str
]) – (experimental) Role to pass to CloudFormation for deployment. Default: - use the bootstrap cfn-exec rolestacks (
Optional
[Sequence
[str
]]) – (experimental) List of stacks to deploy. Default: - all stacksstaging (
Optional
[bool
]) – (experimental) Copy assets to the output directory. Needed for local debugging the source files with SAM CLI Default: falsestrict (
Optional
[bool
]) – (experimental) Do not construct stacks with warnings. Default: falsetrace (
Optional
[bool
]) – (experimental) Print trace for stack warnings. Default: falseverbose (
Optional
[bool
]) – (experimental) show debug logs. Default: falseversion_reporting (
Optional
[bool
]) – (experimental) Include “AWS::CDK::Metadata” resource in synthesized templates. Default: true
- Stability:
experimental
- Return type:
None
Static Methods
- classmethod from_cdk_app_directory(directory=None, *, app=None, output=None)
(experimental) Create the CLI from a directory containing an AWS CDK app.
- Parameters:
directory (
Optional
[str
]) – the directory of the AWS CDK app. Defaults to the current working directory.app (
Optional
[str
]) – (experimental) Command-line for executing your app or a cloud assembly directory e.g. “node bin/my-app.js” or “cdk.out”. Default: - read from cdk.jsonoutput (
Optional
[str
]) – (experimental) Emits the synthesized cloud assembly into a directory. Default: cdk.out
- Return type:
- Returns:
an instance of
AwsCdkCli
- Stability:
experimental
- classmethod from_cloud_assembly_directory_producer(producer)
(experimental) Create the CLI from a CloudAssemblyDirectoryProducer.
- Parameters:
producer (
ICloudAssemblyDirectoryProducer
) –- Stability:
experimental
- Return type: