# CliCredentialsStackSynthesizer

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.

Extends: [StackSynthesizer](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.StackSynthesizer.html) › CliCredentialsStackSynthesizer
Implements: [IBoundStackSynthesizer](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IBoundStackSynthesizer.html), [IReusableStackSynthesizer](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IReusableStackSynthesizer.html), [IStackSynthesizer](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IStackSynthesizer.html)

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

## Example

TypeScript:

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

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk

cli_credentials_stack_synthesizer = cdk.CliCredentialsStackSynthesizer(
    bucket_prefix="bucketPrefix",
    docker_tag_prefix="dockerTagPrefix",
    file_assets_bucket_name="fileAssetsBucketName",
    image_assets_repository_name="imageAssetsRepositoryName",
    qualifier="qualifier"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;

CliCredentialsStackSynthesizer cliCredentialsStackSynthesizer = CliCredentialsStackSynthesizer.Builder.create()
        .bucketPrefix("bucketPrefix")
        .dockerTagPrefix("dockerTagPrefix")
        .fileAssetsBucketName("fileAssetsBucketName")
        .imageAssetsRepositoryName("imageAssetsRepositoryName")
        .qualifier("qualifier")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;

var cliCredentialsStackSynthesizer = new CliCredentialsStackSynthesizer(new CliCredentialsStackSynthesizerProps {
    BucketPrefix = "bucketPrefix",
    DockerTagPrefix = "dockerTagPrefix",
    FileAssetsBucketName = "fileAssetsBucketName",
    ImageAssetsRepositoryName = "imageAssetsRepositoryName",
    Qualifier = "qualifier"
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"

cliCredentialsStackSynthesizer := cdk.NewCliCredentialsStackSynthesizer(&CliCredentialsStackSynthesizerProps{
	BucketPrefix: jsii.String("bucketPrefix"),
	DockerTagPrefix: jsii.String("dockerTagPrefix"),
	FileAssetsBucketName: jsii.String("fileAssetsBucketName"),
	ImageAssetsRepositoryName: jsii.String("imageAssetsRepositoryName"),
	Qualifier: jsii.String("qualifier"),
})
```

## Initializer

TypeScript:

```ts
new CliCredentialsStackSynthesizer(props?: CliCredentialsStackSynthesizerProps)
```

Python:

```python
CliCredentialsStackSynthesizer(props: typing.Optional[CliCredentialsStackSynthesizerProps] = None)
```

Java:

```java
new CliCredentialsStackSynthesizer(CliCredentialsStackSynthesizerProps props)
```

C# / .NET:

```csharp
new CliCredentialsStackSynthesizer(CliCredentialsStackSynthesizerProps? props = null)
```

Golang:

```go
NewCliCredentialsStackSynthesizer(Props CliCredentialsStackSynthesizerProps)
```

## 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.
