DefaultStackSynthesizer Class
Uses conventionally named roles and asset storage locations.
This synthesizer:
- Supports cross-account deployments (the CLI can have credentials to one account, and you can still deploy to another account by assuming roles with well-known names in the other account).
- Supports the CDK Pipelines library.
Requires the environment to have been bootstrapped with Bootstrap Stack V2 (also known as "modern bootstrap stack"). The synthesizer adds a version check to the template, to make sure the bootstrap stack is recent enough to support all features expected by this synthesizer.
Example
class MyStack extends Stack {
constructor(scope: Construct, id: string, props: StackProps) {
super(scope, id, {
...props,
synthesizer: new DefaultStackSynthesizer({
deployRoleExternalId: '',
deployRoleAdditionalOptions: {
// https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html#API_AssumeRole_RequestParameters
},
fileAssetPublishingExternalId: '',
fileAssetPublishingRoleAdditionalOptions: {
// https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html#API_AssumeRole_RequestParameters
},
imageAssetPublishingExternalId: '',
imageAssetPublishingRoleAdditionalOptions: {
// https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html#API_AssumeRole_RequestParameters
},
lookupRoleExternalId: '',
lookupRoleAdditionalOptions: {
// https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html#API_AssumeRole_RequestParameters
},
})
});
}
}
class MyStack(Stack):
def __init__(self, scope, id, *, description=None, env=None, stackName=None, tags=None, notificationArns=None, synthesizer=None, terminationProtection=None, analyticsReporting=None, crossRegionReferences=None, permissionsBoundary=None, suppressTemplateIndentation=None, propertyInjectors=None):
super().__init__(scope, id,
(SpreadAssignment ...props
description=description, env=env, stackName=stackName, tags=tags, notificationArns=notificationArns, synthesizer=synthesizer, terminationProtection=terminationProtection, analyticsReporting=analyticsReporting, crossRegionReferences=crossRegionReferences, permissionsBoundary=permissionsBoundary, suppressTemplateIndentation=suppressTemplateIndentation, propertyInjectors=propertyInjectors),
synthesizer=DefaultStackSynthesizer(
deploy_role_external_id="",
deploy_role_additional_options={},
file_asset_publishing_external_id="",
file_asset_publishing_role_additional_options={},
image_asset_publishing_external_id="",
image_asset_publishing_role_additional_options={},
lookup_role_external_id="",
lookup_role_additional_options={}
)
)
public class MyStack extends Stack {
public MyStack(Construct scope, String id, StackProps props) {
super(scope, id, StackProps.builder()
(SpreadAssignment ...props
props)
.synthesizer(DefaultStackSynthesizer.Builder.create()
.deployRoleExternalId("")
.deployRoleAdditionalOptions(Map.of())
.fileAssetPublishingExternalId("")
.fileAssetPublishingRoleAdditionalOptions(Map.of())
.imageAssetPublishingExternalId("")
.imageAssetPublishingRoleAdditionalOptions(Map.of())
.lookupRoleExternalId("")
.lookupRoleAdditionalOptions(Map.of())
.build())
.build());
}
}
// Install: dotnet add package Amazon.CDK.Lib
class MyStack : Stack
{
public MyStack(Construct scope, string id, StackProps props) : base(scope, id, new StackProps {
(SpreadAssignment ...props
props),
Synthesizer = new DefaultStackSynthesizer(new DefaultStackSynthesizerProps {
DeployRoleExternalId = "",
DeployRoleAdditionalOptions = new Dictionary<string, object> { },
FileAssetPublishingExternalId = "",
FileAssetPublishingRoleAdditionalOptions = new Dictionary<string, object> { },
ImageAssetPublishingExternalId = "",
ImageAssetPublishingRoleAdditionalOptions = new Dictionary<string, object> { },
LookupRoleExternalId = "",
LookupRoleAdditionalOptions = new Dictionary<string, object> { }
})
})
{
}
}
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
type myStack struct {
Stack
}
func newMyStack(scope Construct, id *string, props StackProps) *myStack {
this := &myStack{}
newStack_Override(this, scope, id, &StackProps{
(SpreadAssignment ...props
Props),
Synthesizer: awscdk.NewDefaultStackSynthesizer(&DefaultStackSynthesizerProps{
DeployRoleExternalId: jsii.String(""),
DeployRoleAdditionalOptions: map[string]interface{}{
},
FileAssetPublishingExternalId: jsii.String(""),
FileAssetPublishingRoleAdditionalOptions: map[string]interface{}{
},
ImageAssetPublishingExternalId: jsii.String(""),
ImageAssetPublishingRoleAdditionalOptions: map[string]interface{}{
},
LookupRoleExternalId: jsii.String(""),
LookupRoleAdditionalOptions: map[string]interface{}{
},
}),
})
return this
}
Initializer
new DefaultStackSynthesizer(props?: DefaultStackSynthesizerProps)
DefaultStackSynthesizer(props: typing.Optional[DefaultStackSynthesizerProps] = None)
new DefaultStackSynthesizer(DefaultStackSynthesizerProps props)
new DefaultStackSynthesizer(DefaultStackSynthesizerProps? props = null)
NewDefaultStackSynthesizer(Props DefaultStackSynthesizerProps)
Properties
bootstrapQualifiermay be undefinedstringbootstrap_qualifiermay be undefinedstrbootstrapQualifiermay be undefinedStringBootstrapQualifiermay be undefinedstringBootstrapQualifiermay be undefined*string#cloudFormationExecutionRolemay be undefinedstringcloud_formation_execution_rolemay be undefinedstrcloudFormationExecutionRolemay be undefinedStringCloudFormationExecutionRolemay be undefinedstringCloudFormationExecutionRolemay be undefined*string#cloudFormationExecutionRoleArnstringcloud_formation_execution_role_arnstrcloudFormationExecutionRoleArnStringCloudFormationExecutionRoleArnstringCloudFormationExecutionRoleArn*string#DEFAULT_BOOTSTRAP_STACK_VERSION_SSM_PARAMETERstringdefault_bootstrap_stack_version_ssm_parameterstrDEFAULT_BOOTSTRAP_STACK_VERSION_SSM_PARAMETERStringDEFAULT_BOOTSTRAP_STACK_VERSION_SSM_PARAMETERstringDEFAULT_BOOTSTRAP_STACK_VERSION_SSM_PARAMETER*stringstatic#DEFAULT_CLOUDFORMATION_ROLE_ARNstringdefault_cloudformation_role_arnstrDEFAULT_CLOUDFORMATION_ROLE_ARNStringDEFAULT_CLOUDFORMATION_ROLE_ARNstringDEFAULT_CLOUDFORMATION_ROLE_ARN*stringstatic#DEFAULT_DEPLOY_ROLE_ARNstringdefault_deploy_role_arnstrDEFAULT_DEPLOY_ROLE_ARNStringDEFAULT_DEPLOY_ROLE_ARNstringDEFAULT_DEPLOY_ROLE_ARN*stringstatic#DEFAULT_DOCKER_ASSET_PREFIXstringdefault_docker_asset_prefixstrDEFAULT_DOCKER_ASSET_PREFIXStringDEFAULT_DOCKER_ASSET_PREFIXstringDEFAULT_DOCKER_ASSET_PREFIX*stringstatic#DEFAULT_FILE_ASSET_KEY_ARN_EXPORT_NAMEstringdefault_file_asset_key_arn_export_namestrDEFAULT_FILE_ASSET_KEY_ARN_EXPORT_NAMEStringDEFAULT_FILE_ASSET_KEY_ARN_EXPORT_NAMEstringDEFAULT_FILE_ASSET_KEY_ARN_EXPORT_NAME*stringstatic#DEFAULT_FILE_ASSET_PREFIXstringdefault_file_asset_prefixstrDEFAULT_FILE_ASSET_PREFIXStringDEFAULT_FILE_ASSET_PREFIXstringDEFAULT_FILE_ASSET_PREFIX*stringstatic#DEFAULT_FILE_ASSET_PUBLISHING_ROLE_ARNstringdefault_file_asset_publishing_role_arnstrDEFAULT_FILE_ASSET_PUBLISHING_ROLE_ARNStringDEFAULT_FILE_ASSET_PUBLISHING_ROLE_ARNstringDEFAULT_FILE_ASSET_PUBLISHING_ROLE_ARN*stringstatic#DEFAULT_FILE_ASSETS_BUCKET_NAMEstringdefault_file_assets_bucket_namestrDEFAULT_FILE_ASSETS_BUCKET_NAMEStringDEFAULT_FILE_ASSETS_BUCKET_NAMEstringDEFAULT_FILE_ASSETS_BUCKET_NAME*stringstatic#DEFAULT_IMAGE_ASSET_PUBLISHING_ROLE_ARNstringdefault_image_asset_publishing_role_arnstrDEFAULT_IMAGE_ASSET_PUBLISHING_ROLE_ARNStringDEFAULT_IMAGE_ASSET_PUBLISHING_ROLE_ARNstringDEFAULT_IMAGE_ASSET_PUBLISHING_ROLE_ARN*stringstatic#DEFAULT_IMAGE_ASSETS_REPOSITORY_NAMEstringdefault_image_assets_repository_namestrDEFAULT_IMAGE_ASSETS_REPOSITORY_NAMEStringDEFAULT_IMAGE_ASSETS_REPOSITORY_NAMEstringDEFAULT_IMAGE_ASSETS_REPOSITORY_NAME*stringstatic#DEFAULT_LOOKUP_ROLE_ARNstringdefault_lookup_role_arnstrDEFAULT_LOOKUP_ROLE_ARNStringDEFAULT_LOOKUP_ROLE_ARNstringDEFAULT_LOOKUP_ROLE_ARN*stringstatic#DEFAULT_QUALIFIERstringdefault_qualifierstrDEFAULT_QUALIFIERStringDEFAULT_QUALIFIERstringDEFAULT_QUALIFIER*stringstatic#lookupRolemay be undefinedstringlookup_rolemay be undefinedstrlookupRolemay be undefinedStringLookupRolemay be undefinedstringLookupRolemay be undefined*string#Methods
addDockerImageAsset(asset: DockerImageAssetSource): DockerImageAssetLocationdef add_docker_image_asset(self, asset: DockerImageAssetSource) -> DockerImageAssetLocationpublic DockerImageAssetLocation addDockerImageAsset(DockerImageAssetSource asset)public DockerImageAssetLocation AddDockerImageAsset(DockerImageAssetSource asset)func AddDockerImageAsset(Asset DockerImageAssetSource) DockerImageAssetLocation#notes
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): FileAssetLocationdef add_file_asset(self, asset: FileAssetSource) -> FileAssetLocationpublic FileAssetLocation addFileAsset(FileAssetSource asset)public FileAssetLocation AddFileAsset(FileAssetSource asset)func AddFileAsset(Asset FileAssetSource) FileAssetLocation#notes
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): voiddef bind(self, stack: Stack) -> Nonepublic void bind(Stack stack)public void Bind(Stack stack)func Bind(Stack Stack)#Must be called before any of the other methods are called.
reusableBind(stack: Stack): IBoundStackSynthesizerdef reusable_bind(self, stack: Stack) -> IBoundStackSynthesizerpublic IBoundStackSynthesizer reusableBind(Stack stack)public IBoundStackSynthesizer ReusableBind(Stack stack)func ReusableBind(Stack Stack) IBoundStackSynthesizer#This method may be called more than once on the same object.
synthesize(session: ISynthesisSession): voiddef synthesize(self, session: ISynthesisSession) -> Nonepublic void synthesize(ISynthesisSession session)public void Synthesize(ISynthesisSession session)func Synthesize(Session ISynthesisSession)#