# LegacyStackSynthesizer

Use the CDK classic way of referencing assets.

This synthesizer will generate CloudFormation parameters for every referenced
asset, and use the CLI's current credentials to deploy the stack.

- It does not support cross-account deployment (the CLI must have credentials
  to the account you are trying to deploy to).
- It cannot be used with **CDK Pipelines**. To deploy using CDK Pipelines,
  you must use the `DefaultStackSynthesizer`.
- Each asset will take up a CloudFormation Parameter in your template. Keep in
  mind that there is a maximum of 200 parameters in a CloudFormation template.
  To use deterministic asset locations instead, use `CliCredentialsStackSynthesizer`.

Be aware that your CLI credentials must be valid for the duration of the
entire deployment. If you are using session credentials, make sure the
session lifetime is long enough.

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

Extends: StackSynthesizer › LegacyStackSynthesizer
Implements: IBoundStackSynthesizer, IReusableStackSynthesizer, IStackSynthesizer

- Source: [`core/lib/stack-synthesizers/legacy.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/core/lib/stack-synthesizers/legacy.ts#L50)
- Type last changed: v2.61.0 · 19 Jan 2023

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
const legacyStackSynthesizer = new cdk.LegacyStackSynthesizer();
```

## Initializer

```ts
new LegacyStackSynthesizer()
```

## Properties

- `bootstrapQualifier`: string — The qualifier used to bootstrap this stack.

- `cloudFormationExecutionRole`: string — The role that is passed to CloudFormation to execute the change set.

- `lookupRole`: string — The role used to lookup for this stack.

## Methods

- `addDockerImageAsset(asset: DockerImageAssetSource): DockerImageAssetLocation` — Register a Docker Image Asset.

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

  The synthesizer must rely on some out-of-band mechanism to make sure the given files
  are actually placed in the returned location before the deployment happens. This can
  be by writing the instructions to the asset manifest (for use by the `cdk-assets` tool),
  by relying on the CLI to upload files (legacy behavior), or some other operator controlled
  mechanism.

- `addFileAsset(asset: FileAssetSource): FileAssetLocation` — Register a File Asset.

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

  The synthesizer must rely on some out-of-band mechanism to make sure the given files
  are actually placed in the returned location before the deployment happens. This can
  be by writing the instructions to the asset manifest (for use by the `cdk-assets` tool),
  by relying on the CLI to upload files (legacy behavior), or some other operator controlled
  mechanism.

- `bind(stack: Stack): void` — Bind to the stack this environment is going to be used on.

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

- `reusableBind(stack: Stack): IBoundStackSynthesizer` — Produce a bound Stack Synthesizer for the given stack.

  This method may be called more than once on the same object.

- `synthesize(session: ISynthesisSession): void` — Synthesize the associated stack to the session.
