> **Experimental**
>
> `@aws-cdk/app-staging-synthesizer-alpha` is an [**experimental**](https://docs.aws.amazon.com/cdk/api/stability.html) (alpha) package: its API may change in any release, without a major version bump.
# DefaultStagingStackOptions

User configurable options to the DefaultStagingStack.

Used as argument in: [DefaultStagingStack.factory](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_app-staging-synthesizer-alpha.DefaultStagingStack.html#factory)

- Stability: [Experimental](https://docs.aws.amazon.com/cdk/api/stability.html)
- Source: [`lib/default-staging-stack.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/app-staging-synthesizer-alpha/lib/default-staging-stack.ts#L47)

## Example

TypeScript:

```ts
import { BucketEncryption } from 'aws-cdk-lib/aws-s3';
const defaultStagingStack = DefaultStagingStack.factory({ appId: 'my-app-id', stagingBucketEncryption: BucketEncryption.S3_MANAGED });
```

Python:

```python
from aws_cdk.aws_s3 import BucketEncryption

default_staging_stack = DefaultStagingStack.factory(app_id="my-app-id", staging_bucket_encryption=BucketEncryption.S3_MANAGED)
```

Java:

```java
import software.amazon.awscdk.services.s3.BucketEncryption;

IStagingResourcesFactory defaultStagingStack = DefaultStagingStack.factory(DefaultStagingStackOptions.builder().appId("my-app-id").stagingBucketEncryption(BucketEncryption.S3_MANAGED).build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AppStagingSynthesizer.Alpha
using Amazon.CDK.AWS.S3;

var defaultStagingStack = DefaultStagingStack.Factory(new DefaultStagingStackOptions { AppId = "my-app-id", StagingBucketEncryption = BucketEncryption.S3_MANAGED });
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/appstagingsynthesizeralpha/v2
import "github.com/aws/aws-cdk-go/awscdk"

defaultStagingStack := appstagingsynthesizeralpha.DefaultStagingStack_Factory(&DefaultStagingStackOptions{
	AppId: jsii.String("my-app-id"),
	StagingBucketEncryption: awscdk.BucketEncryption_S3_MANAGED,
})
```

## Properties

- `appId`: string (required) — A unique identifier for the application that the staging stack belongs to.

  This identifier will be used in the name of staging resources
  created for this application, and should be unique across CDK apps.

  The identifier should include lowercase characters and dashes ('-') only
  and have a maximum of 20 characters.

- `autoDeleteStagingAssets`: boolean = true — Auto deletes objects in the staging S3 bucket and images in the staging ECR repositories.

- `deployTimeFileAssetLifetime`: [Duration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.days(30) — The lifetime for deploy time file assets.

  Assets that are only necessary at deployment time (for instance,
  CloudFormation templates and Lambda source code bundles) will be
  automatically deleted after this many days. Assets that may be
  read from the staging bucket during your application's run time
  will not be deleted.

  Set this to the length of time you wish to be able to roll back to
  previous versions of your application without having to do a new
  `cdk synth` and re-upload of assets.

- `fileAssetPublishingRole`: [BootstrapRole](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_app-staging-synthesizer-alpha.BootstrapRole.html) — Pass in an existing role to be used as the file publishing role.

  **Default:** a new role will be created

- `imageAssetPublishingRole`: [BootstrapRole](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_app-staging-synthesizer-alpha.BootstrapRole.html) — Pass in an existing role to be used as the image publishing role.

  **Default:** a new role will be created

- `imageAssetVersionCount`: number — The maximum number of image versions to store in a repository.

  **Default:** up to 3 versions stored

  Previous versions of an image can be stored for rollback purposes.
  Once a repository has more than 3 image versions stored, the oldest
  version will be discarded. This allows for sensible garbage collection
  while maintaining a few previous versions for rollback scenarios.

- `stagingBucketEncryption`: [BucketEncryption](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketEncryption.html) (required) — Encryption type for staging bucket.

  In future versions of this package, the default will be BucketEncryption.S3_MANAGED.

  In previous versions of this package, the default was to use KMS encryption for the staging bucket. KMS keys cost
  $1/month, which could result in unexpected costs for users who are not aware of this. As we stabilize this module
  we intend to make the default S3-managed encryption, which is free. However, the migration path from KMS to S3
  managed encryption for existing buckets is not straightforward. Therefore, for now, this property is required.

  If you have an existing staging bucket encrypted with a KMS key, you will likely want to set this property to
  BucketEncryption.KMS. If you are creating a new staging bucket, you can set this property to
  BucketEncryption.S3_MANAGED to avoid the cost of a KMS key.

- `stagingBucketName`: string — Explicit name for the staging bucket.

  **Default:** a well-known name unique to this app/env.

- `stagingStackNamePrefix`: string = 'StagingStack' — Specify a custom prefix to be used as the staging stack name and construct ID.

  The prefix will be appended before the appId, which
  is required to be part of the stack name and construct ID to
  ensure uniqueness.
