class aws_cdk.core.LegacyStackSynthesizer

Bases: aws_cdk.core.StackSynthesizer

Use the original deployment environment.

This deployment environment is restricted in cross-environment deployments, CI/CD deployments, and will use up CloudFormation parameters in your template.

This is the only StackSynthesizer that supports customizing asset behavior by overriding Stack.addFileAsset() and Stack.addDockerImageAsset().


add_docker_image_asset(*, directory_name, source_hash, docker_build_args=None, docker_build_target=None, docker_file=None, repository_name=None)

Register a Docker Image Asset.

Returns the parameters that can be used to refer to the asset inside the template.

  • directory_name (str) – The directory where the Dockerfile is stored, must be relative to the cloud assembly root.

  • source_hash (str) – The hash of the contents of the docker build context. This hash is used throughout the system to identify this image and avoid duplicate work in case the source did not change. NOTE: this means that if you wish to update your docker image, you must make a modification to the source (e.g. add some metadata to your Dockerfile).

  • docker_build_args (Optional[Mapping[str, str]]) – Build args to pass to the docker build command. Since Docker build arguments are resolved before deployment, keys and values cannot refer to unresolved tokens (such as lambda.functionArn or queue.queueUrl). Default: - no build args are passed

  • docker_build_target (Optional[str]) – Docker target to build to. Default: - no target

  • docker_file (Optional[str]) – Path to the Dockerfile (relative to the directory). Default: - no file

  • repository_name (Optional[str]) – (deprecated) ECR repository name. Specify this property if you need to statically address the image, e.g. from a Kubernetes Pod. Note, this is only the repository name, without the registry and the tag parts. Default: - automatically derived from the asset’s ID.

Return type


add_file_asset(*, file_name, packaging, source_hash)

Register a File Asset.

Returns the parameters that can be used to refer to the asset inside the template.

  • file_name (str) – The path, relative to the root of the cloud assembly, in which this asset source resides. This can be a path to a file or a directory, dependning on the packaging type.

  • packaging (FileAssetPackaging) – Which type of packaging to perform.

  • source_hash (str) – A hash on the content source. This hash is used to uniquely identify this asset throughout the system. If this value doesn’t change, the asset will not be rebuilt or republished.

Return type



Bind to the stack this environment is going to be used on.

Must be called before any of the other methods are called.


stack (Stack) –

Return type



Synthesize the associated stack to the session.


session (ISynthesisSession) –

Return type