aws-cdk-lib.CliCredentialsStackSynthesizer

class CliCredentialsStackSynthesizer

LanguageType name
.NETAmazon.CDK.CliCredentialsStackSynthesizer
Gogithub.com/aws/aws-cdk-go/awscdk/v2#CliCredentialsStackSynthesizer
Javasoftware.amazon.awscdk.CliCredentialsStackSynthesizer
Pythonaws_cdk.CliCredentialsStackSynthesizer
TypeScript (source)aws-cdk-lib » CliCredentialsStackSynthesizer

Implements IStackSynthesizer, IReusableStackSynthesizer, IBoundStackSynthesizer

Extends StackSynthesizer

A synthesizer that uses conventional asset locations, but not conventional deployment roles.

Instead of assuming the bootstrapped deployment roles, all stack operations will be performed using the CLI's current credentials.

  • This synthesizer does not support deploying to accounts to which the CLI does not have credentials. It also does not support deploying using CDK Pipelines. For either of those features, use DefaultStackSynthesizer.
  • This synthesizer requires an S3 bucket and ECR repository with well-known names. To not depend on those, use LegacyStackSynthesizer.

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.

By default, expects the environment to have been bootstrapped with just the staging resources of the Bootstrap Stack V2 (also known as "modern bootstrap stack"). You can override the default names using the synthesizer's construction properties.

Example

// 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 cliCredentialsStackSynthesizer = new cdk.CliCredentialsStackSynthesizer(/* all optional props */ {
  bucketPrefix: 'bucketPrefix',
  dockerTagPrefix: 'dockerTagPrefix',
  fileAssetsBucketName: 'fileAssetsBucketName',
  imageAssetsRepositoryName: 'imageAssetsRepositoryName',
  qualifier: 'qualifier',
});

Initializer

new CliCredentialsStackSynthesizer(props?: CliCredentialsStackSynthesizerProps)

Parameters

  • props CliCredentialsStackSynthesizerProps

Properties

NameTypeDescription
bootstrapQualifier?stringThe qualifier used to bootstrap this stack.
lookupRole?stringThe role used to lookup for this stack.

bootstrapQualifier?

Type: string (optional)

The qualifier used to bootstrap this stack.


lookupRole?

Type: string (optional)

The role used to lookup for this stack.

Methods

NameDescription
addDockerImageAsset(asset)Register a Docker Image Asset.
addFileAsset(asset)Register a File Asset.
bind(stack)Bind to the stack this environment is going to be used on.
reusableBind(stack)Produce a bound Stack Synthesizer for the given stack.
synthesize(session)Synthesize the associated stack to the session.

addDockerImageAsset(asset)

public addDockerImageAsset(asset: DockerImageAssetSource): DockerImageAssetLocation

Parameters

  • asset DockerImageAssetSource

Returns

  • 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)

public addFileAsset(asset: FileAssetSource): FileAssetLocation

Parameters

  • asset FileAssetSource

Returns

  • 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)

public bind(stack: Stack): void

Parameters

  • stack Stack

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)

public reusableBind(stack: Stack): IBoundStackSynthesizer

Parameters

  • stack Stack

Returns

  • IBoundStackSynthesizer

Produce a bound Stack Synthesizer for the given stack.

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


synthesize(session)

public synthesize(session: ISynthesisSession): void

Parameters

  • session ISynthesisSession

Synthesize the associated stack to the session.