Experimental
@aws-cdk/app-staging-synthesizer-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
DefaultStagingStackProps Struct
Default Staging Stack Properties.
| Stability | Experimental |
|---|---|
| Source | lib/default-staging-stack.ts |
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as app_staging_synthesizer_alpha from '@aws-cdk/app-staging-synthesizer-alpha';
import * as cdk from 'aws-cdk-lib';
import { aws_s3 as s3 } from 'aws-cdk-lib';
declare const bootstrapRole: app_staging_synthesizer_alpha.BootstrapRole;
declare const permissionsBoundary: cdk.PermissionsBoundary;
declare const propertyInjector: cdk.IPropertyInjector;
declare const stackSynthesizer: cdk.StackSynthesizer;
const defaultStagingStackProps: app_staging_synthesizer_alpha.DefaultStagingStackProps = {
appId: 'appId',
qualifier: 'qualifier',
stagingBucketEncryption: s3.BucketEncryption.UNENCRYPTED,
// the properties below are optional
analyticsReporting: false,
autoDeleteStagingAssets: false,
crossRegionReferences: false,
deployRoleArn: 'deployRoleArn',
deployTimeFileAssetLifetime: cdk.Duration.minutes(30),
description: 'description',
env: {
account: 'account',
region: 'region',
},
fileAssetPublishingRole: bootstrapRole,
imageAssetPublishingRole: bootstrapRole,
imageAssetVersionCount: 123,
notificationArns: ['notificationArns'],
permissionsBoundary: permissionsBoundary,
propertyInjectors: [propertyInjector],
stackName: 'stackName',
stagingBucketName: 'stagingBucketName',
stagingStackNamePrefix: 'stagingStackNamePrefix',
suppressTemplateIndentation: false,
synthesizer: stackSynthesizer,
tags: {
tagsKey: 'tags',
},
terminationProtection: false,
};
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.app_staging_synthesizer_alpha as app_staging_synthesizer_alpha
import aws_cdk as cdk
from aws_cdk import aws_s3 as s3
# bootstrap_role: app_staging_synthesizer_alpha.BootstrapRole
# permissions_boundary: cdk.PermissionsBoundary
# property_injector: cdk.IPropertyInjector
# stack_synthesizer: cdk.StackSynthesizer
default_staging_stack_props = app_staging_synthesizer_alpha.DefaultStagingStackProps(
app_id="appId",
qualifier="qualifier",
staging_bucket_encryption=s3.BucketEncryption.UNENCRYPTED,
# the properties below are optional
analytics_reporting=False,
auto_delete_staging_assets=False,
cross_region_references=False,
deploy_role_arn="deployRoleArn",
deploy_time_file_asset_lifetime=cdk.Duration.minutes(30),
description="description",
env=cdk.Environment(
account="account",
region="region"
),
file_asset_publishing_role=bootstrap_role,
image_asset_publishing_role=bootstrap_role,
image_asset_version_count=123,
notification_arns=["notificationArns"],
permissions_boundary=permissions_boundary,
property_injectors=[property_injector],
stack_name="stackName",
staging_bucket_name="stagingBucketName",
staging_stack_name_prefix="stagingStackNamePrefix",
suppress_template_indentation=False,
synthesizer=stack_synthesizer,
tags={
"tags_key": "tags"
},
termination_protection=False
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.app.staging.synthesizer.alpha.*;
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.s3.*;
BootstrapRole bootstrapRole;
PermissionsBoundary permissionsBoundary;
IPropertyInjector propertyInjector;
StackSynthesizer stackSynthesizer;
DefaultStagingStackProps defaultStagingStackProps = DefaultStagingStackProps.builder()
.appId("appId")
.qualifier("qualifier")
.stagingBucketEncryption(BucketEncryption.UNENCRYPTED)
// the properties below are optional
.analyticsReporting(false)
.autoDeleteStagingAssets(false)
.crossRegionReferences(false)
.deployRoleArn("deployRoleArn")
.deployTimeFileAssetLifetime(Duration.minutes(30))
.description("description")
.env(Environment.builder()
.account("account")
.region("region")
.build())
.fileAssetPublishingRole(bootstrapRole)
.imageAssetPublishingRole(bootstrapRole)
.imageAssetVersionCount(123)
.notificationArns(List.of("notificationArns"))
.permissionsBoundary(permissionsBoundary)
.propertyInjectors(List.of(propertyInjector))
.stackName("stackName")
.stagingBucketName("stagingBucketName")
.stagingStackNamePrefix("stagingStackNamePrefix")
.suppressTemplateIndentation(false)
.synthesizer(stackSynthesizer)
.tags(Map.of(
"tagsKey", "tags"))
.terminationProtection(false)
.build();
// Install: dotnet add package Amazon.CDK.AppStagingSynthesizer.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AppStagingSynthesizer.Alpha;
using Amazon.CDK;
using Amazon.CDK.AWS.S3;
BootstrapRole bootstrapRole;
PermissionsBoundary permissionsBoundary;
IPropertyInjector propertyInjector;
StackSynthesizer stackSynthesizer;
var defaultStagingStackProps = new DefaultStagingStackProps {
AppId = "appId",
Qualifier = "qualifier",
StagingBucketEncryption = BucketEncryption.UNENCRYPTED,
// the properties below are optional
AnalyticsReporting = false,
AutoDeleteStagingAssets = false,
CrossRegionReferences = false,
DeployRoleArn = "deployRoleArn",
DeployTimeFileAssetLifetime = Duration.Minutes(30),
Description = "description",
Env = new Environment {
Account = "account",
Region = "region"
},
FileAssetPublishingRole = bootstrapRole,
ImageAssetPublishingRole = bootstrapRole,
ImageAssetVersionCount = 123,
NotificationArns = new [] { "notificationArns" },
PermissionsBoundary = permissionsBoundary,
PropertyInjectors = new [] { propertyInjector },
StackName = "stackName",
StagingBucketName = "stagingBucketName",
StagingStackNamePrefix = "stagingStackNamePrefix",
SuppressTemplateIndentation = false,
Synthesizer = stackSynthesizer,
Tags = new Dictionary<string, string> {
{ "tagsKey", "tags" }
},
TerminationProtection = false
};
// Install: go get github.com/aws/aws-cdk-go/appstagingsynthesizeralpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import app_staging_synthesizer_alpha "github.com/aws/aws-cdk-go/appstagingsynthesizeralpha"
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var bootstrapRole BootstrapRole
var permissionsBoundary PermissionsBoundary
var propertyInjector IPropertyInjector
var stackSynthesizer StackSynthesizer
defaultStagingStackProps := &DefaultStagingStackProps{
AppId: jsii.String("appId"),
Qualifier: jsii.String("qualifier"),
StagingBucketEncryption: awscdk.Aws_s3.BucketEncryption_UNENCRYPTED,
// the properties below are optional
AnalyticsReporting: jsii.Boolean(false),
AutoDeleteStagingAssets: jsii.Boolean(false),
CrossRegionReferences: jsii.Boolean(false),
DeployRoleArn: jsii.String("deployRoleArn"),
DeployTimeFileAssetLifetime: cdk.Duration_Minutes(jsii.Number(30)),
Description: jsii.String("description"),
Env: &Environment{
Account: jsii.String("account"),
Region: jsii.String("region"),
},
FileAssetPublishingRole: bootstrapRole,
ImageAssetPublishingRole: bootstrapRole,
ImageAssetVersionCount: jsii.Number(123),
NotificationArns: []*string{
jsii.String("notificationArns"),
},
PermissionsBoundary: permissionsBoundary,
PropertyInjectors: []IPropertyInjector{
propertyInjector,
},
StackName: jsii.String("stackName"),
StagingBucketName: jsii.String("stagingBucketName"),
StagingStackNamePrefix: jsii.String("stagingStackNamePrefix"),
SuppressTemplateIndentation: jsii.Boolean(false),
Synthesizer: stackSynthesizer,
Tags: map[string]*string{
"tagsKey": jsii.String("tags"),
},
TerminationProtection: jsii.Boolean(false),
}
Properties
analyticsReportingoptionalbooleananalytics_reportingoptionalboolanalyticsReportingoptionalBooleanAnalyticsReportingoptionalboolAnalyticsReportingoptional*bool #Default: analyticsReporting setting of containing App, or value of 'aws:cdk:version-reporting' context key
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.
autoDeleteStagingAssetsoptionalbooleanauto_delete_staging_assetsoptionalboolautoDeleteStagingAssetsoptionalBooleanAutoDeleteStagingAssetsoptionalboolAutoDeleteStagingAssetsoptional*bool = true #crossRegionReferencesoptionalbooleancross_region_referencesoptionalboolcrossRegionReferencesoptionalBooleanCrossRegionReferencesoptionalboolCrossRegionReferencesoptional*bool = false #Enabling this will create a CloudFormation custom resource in both the producing stack and consuming stack in order to perform the export/import
This feature is currently experimental
deployRoleArnoptionalstringdeploy_role_arnoptionalstrdeployRoleArnoptionalStringDeployRoleArnoptionalstringDeployRoleArnoptional*string #Default: The CLI credentials are assumed, no additional permissions are granted.
This role will need permissions to read from to the staging resources.
deployTimeFileAssetLifetimeoptionalDurationdeploy_time_file_asset_lifetimeoptionalDurationdeployTimeFileAssetLifetimeoptionalDurationDeployTimeFileAssetLifetimeoptionalDurationDeployTimeFileAssetLifetimeoptionalDuration = Duration.days(30) #notes
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.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #Default: No description.
envoptionalEnvironmentenvoptionalEnvironmentenvoptionalEnvironmentEnvoptionalEnvironmentEnvoptionalEnvironment #Default: The environment of the containing Stage if available, otherwise create the stack will be environment-agnostic.
notes · example
Set the region/account fields of env to either a concrete value to select the indicated environment (recommended for production stacks), or to the values of environment variables CDK_DEFAULT_REGION/CDK_DEFAULT_ACCOUNT to let the target environment depend on the AWS credentials/configuration that the CDK CLI is executed under (recommended for development stacks).
If the Stack is instantiated inside a Stage, any undefined region/account fields from env will default to the same field on the encompassing Stage, if configured there.
If either region or account are not set nor inherited from Stage, the Stack will be considered "environment-agnostic"". Environment-agnostic stacks can be deployed to any environment but may not be able to take advantage of all features of the CDK. For example, they will not be able to use environmental context lookups such as ec2.Vpc.fromLookup and will not automatically translate Service Principals to the right format based on the environment's AWS partition, and other such enhancements.
// Use a concrete account and region to deploy this stack to:
// `.account` and `.region` will simply return these values.
new Stack(app, 'Stack1', {
env: {
account: '123456789012',
region: 'us-east-1'
},
});
// Use the CLI's current credentials to determine the target environment:
// `.account` and `.region` will reflect the account+region the CLI
// is configured to use (based on the user CLI credentials)
new Stack(app, 'Stack2', {
env: {
account: process.env.CDK_DEFAULT_ACCOUNT,
region: process.env.CDK_DEFAULT_REGION
},
});
// Define multiple stacks stage associated with an environment
const myStage = new Stage(app, 'MyStage', {
env: {
account: '123456789012',
region: 'us-east-1'
}
});
// both of these stacks will use the stage's account/region:
// `.account` and `.region` will resolve to the concrete values as above
new MyStack(myStage, 'Stack1');
new YourStack(myStage, 'Stack2');
// Define an environment-agnostic stack:
// `.account` and `.region` will resolve to `{ "Ref": "AWS::AccountId" }` and `{ "Ref": "AWS::Region" }` respectively.
// which will only resolve to actual values by CloudFormation during deployment.
new MyStack(app, 'Stack1');
fileAssetPublishingRoleoptionalBootstrapRolefile_asset_publishing_roleoptionalBootstrapRolefileAssetPublishingRoleoptionalBootstrapRoleFileAssetPublishingRoleoptionalBootstrapRoleFileAssetPublishingRoleoptionalBootstrapRole #Default: a new role will be created
imageAssetPublishingRoleoptionalBootstrapRoleimage_asset_publishing_roleoptionalBootstrapRoleimageAssetPublishingRoleoptionalBootstrapRoleImageAssetPublishingRoleoptionalBootstrapRoleImageAssetPublishingRoleoptionalBootstrapRole #Default: a new role will be created
imageAssetVersionCountoptionalnumberimage_asset_version_countoptionalint | floatimageAssetVersionCountoptionalNumberImageAssetVersionCountoptionaldoubleImageAssetVersionCountoptional*float64 #Default: up to 3 versions stored
notes
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.
notificationArnsoptionalstring[]notification_arnsoptionaltyping.List[str]notificationArnsoptionalList<String>NotificationArnsoptionalstring[]NotificationArnsoptional*[]*string #Default: no notification arns.
permissionsBoundaryoptionalPermissionsBoundarypermissions_boundaryoptionalPermissionsBoundarypermissionsBoundaryoptionalPermissionsBoundaryPermissionsBoundaryoptionalPermissionsBoundaryPermissionsBoundaryoptionalPermissionsBoundary #Default: no permissions boundary is applied
propertyInjectorsoptionalIPropertyInjector[]property_injectorsoptionaltyping.List[IPropertyInjector]propertyInjectorsoptionalList<IPropertyInjector>PropertyInjectorsoptionalIPropertyInjector[]PropertyInjectorsoptional*[]IPropertyInjector #Default: no PropertyInjectors
Can be used to specify custom bootstrapped role names
stackNameoptionalstringstack_nameoptionalstrstackNameoptionalStringStackNameoptionalstringStackNameoptional*string #Default: Derived from construct path.
stagingBucketEncryptionBucketEncryptionstaging_bucket_encryptionBucketEncryptionstagingBucketEncryptionBucketEncryptionStagingBucketEncryptionBucketEncryptionStagingBucketEncryptionBucketEncryption required #notes
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.
stagingBucketNameoptionalstringstaging_bucket_nameoptionalstrstagingBucketNameoptionalStringStagingBucketNameoptionalstringStagingBucketNameoptional*string #Default: a well-known name unique to this app/env.
stagingStackNamePrefixoptionalstringstaging_stack_name_prefixoptionalstrstagingStackNamePrefixoptionalStringStagingStackNamePrefixoptionalstringStagingStackNamePrefixoptional*string = 'StagingStack' #The prefix will be appended before the appId, which is required to be part of the stack name and construct ID to ensure uniqueness.
suppressTemplateIndentationoptionalbooleansuppress_template_indentationoptionalboolsuppressTemplateIndentationoptionalBooleanSuppressTemplateIndentationoptionalboolSuppressTemplateIndentationoptional*bool #Default: the value of @aws-cdk/core:suppressTemplateIndentation, or false if that is not set.
If not specified, the value of the @aws-cdk/core:suppressTemplateIndentation context key will be used. If that is not specified, then the default value false will be used.
synthesizeroptionalIStackSynthesizersynthesizeroptionalIStackSynthesizersynthesizeroptionalIStackSynthesizerSynthesizeroptionalIStackSynthesizerSynthesizeroptionalIStackSynthesizer #Default: The synthesizer specified on App, or DefaultStackSynthesizer otherwise.
notes
The Stack Synthesizer controls aspects of synthesis and deployment, like how assets are referenced and what IAM roles to use. For more information, see the README of the main CDK package.
If not specified, the defaultStackSynthesizer from App will be used. If that is not specified, DefaultStackSynthesizer is used if @aws-cdk/core:newStyleStackSynthesis is set to true or the CDK major version is v2. In CDK v1 LegacyStackSynthesizer is the default if no other synthesizer is specified.
tagsoptional{ [key: string]: string }tagsoptionaltyping.Mapping[str, str]tagsoptionalMap<String, String>TagsoptionalIDictionary<string, string>Tagsoptional*map[string]*string = {} #notes
These tags are applied to the CloudFormation Stack itself. They will not appear in the CloudFormation template.
However, at deployment time, CloudFormation will apply these tags to all resources in the stack that support tagging. You will not be able to exempt resources from tagging (using the excludeResourceTypes property of Tags.of(...).add()) for tags applied in this way.
terminationProtectionoptionalbooleantermination_protectionoptionalboolterminationProtectionoptionalBooleanTerminationProtectionoptionalboolTerminationProtectionoptional*bool = false #