class DefaultStackSynthesizer
Language | Type name |
---|---|
![]() | Amazon.CDK.DefaultStackSynthesizer |
![]() | github.com/aws/aws-cdk-go/awscdk/v2#DefaultStackSynthesizer |
![]() | software.amazon.awscdk.DefaultStackSynthesizer |
![]() | aws_cdk.DefaultStackSynthesizer |
![]() | aws-cdk-lib » DefaultStackSynthesizer |
Implements
IStack
, IReusable
, IBound
Extends
Stack
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
declare const app: App;
const prodStage = new Stage(app, 'ProdStage', {
permissionsBoundary: PermissionsBoundary.fromName('cdk-${Qualifier}-PermissionsBoundary-${AWS::AccountId}-${AWS::Region}'),
});
new Stack(prodStage, 'ProdStack', {
synthesizer: new DefaultStackSynthesizer({
qualifier: 'custom',
}),
});
Initializer
new DefaultStackSynthesizer(props?: DefaultStackSynthesizerProps)
Parameters
Properties
Name | Type | Description |
---|---|---|
cloud | string | Returns the ARN of the CFN execution Role. |
deploy | string | Returns the ARN of the deploy Role. |
bootstrap | string | The qualifier used to bootstrap this stack. |
lookup | string | The role used to lookup for this stack. |
stack? | Stack | Return the currently bound stack. |
static DEFAULT_BOOTSTRAP_STACK_VERSION_SSM_PARAMETER | string | Default bootstrap stack version SSM parameter. |
static DEFAULT_CLOUDFORMATION_ROLE_ARN | string | Default CloudFormation role ARN. |
static DEFAULT_DEPLOY_ROLE_ARN | string | Default deploy role ARN. |
static DEFAULT_DOCKER_ASSET_PREFIX | string | Default Docker asset prefix. |
static DEFAULT_FILE_ASSETS_BUCKET_NAME | string | Default file assets bucket name. |
static DEFAULT_FILE_ASSET_KEY_ARN_EXPORT_NAME | string | Name of the CloudFormation Export with the asset key name. |
static DEFAULT_FILE_ASSET_PREFIX | string | Default file asset prefix. |
static DEFAULT_FILE_ASSET_PUBLISHING_ROLE_ARN | string | Default asset publishing role ARN for file (S3) assets. |
static DEFAULT_IMAGE_ASSETS_REPOSITORY_NAME | string | Default image assets repository name. |
static DEFAULT_IMAGE_ASSET_PUBLISHING_ROLE_ARN | string | Default asset publishing role ARN for image (ECR) assets. |
static DEFAULT_LOOKUP_ROLE_ARN | string | Default lookup role ARN for missing values. |
static DEFAULT_QUALIFIER | string | Default ARN qualifier. |
cloudFormationExecutionRoleArn
Type:
string
Returns the ARN of the CFN execution Role.
deployRoleArn
Type:
string
Returns the ARN of the deploy Role.
bootstrapQualifier?
Type:
string
(optional)
The qualifier used to bootstrap this stack.
lookupRole?
Type:
string
(optional)
The role used to lookup for this stack.
stack?
⚠️ Deprecated: Use boundStack
instead.
Type:
Stack
(optional)
Return the currently bound stack.
static DEFAULT_BOOTSTRAP_STACK_VERSION_SSM_PARAMETER
Type:
string
Default bootstrap stack version SSM parameter.
static DEFAULT_CLOUDFORMATION_ROLE_ARN
Type:
string
Default CloudFormation role ARN.
static DEFAULT_DEPLOY_ROLE_ARN
Type:
string
Default deploy role ARN.
static DEFAULT_DOCKER_ASSET_PREFIX
Type:
string
Default Docker asset prefix.
static DEFAULT_FILE_ASSETS_BUCKET_NAME
Type:
string
Default file assets bucket name.
static DEFAULT_FILE_ASSET_KEY_ARN_EXPORT_NAME
Type:
string
Name of the CloudFormation Export with the asset key name.
static DEFAULT_FILE_ASSET_PREFIX
Type:
string
Default file asset prefix.
static DEFAULT_FILE_ASSET_PUBLISHING_ROLE_ARN
Type:
string
Default asset publishing role ARN for file (S3) assets.
static DEFAULT_IMAGE_ASSETS_REPOSITORY_NAME
Type:
string
Default image assets repository name.
static DEFAULT_IMAGE_ASSET_PUBLISHING_ROLE_ARN
Type:
string
Default asset publishing role ARN for image (ECR) assets.
static DEFAULT_LOOKUP_ROLE_ARN
Type:
string
Default lookup role ARN for missing values.
static DEFAULT_QUALIFIER
Type:
string
Default ARN qualifier.
Methods
Name | Description |
---|---|
add | Register a Docker Image Asset. |
add | Register a File Asset. |
bind(stack) | Bind to the stack this environment is going to be used on. |
reusable | Produce a bound Stack Synthesizer for the given stack. |
synthesize(session) | Synthesize the associated stack to the session. |
protected synthesize | Synthesize the stack template to the given session, passing the configured lookup role ARN. |
addDockerImageAsset(asset)
public addDockerImageAsset(asset: DockerImageAssetSource): DockerImageAssetLocation
Parameters
- asset
Docker
Image Asset Source
Returns
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
File
Asset Source
Returns
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
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
ISynthesis
Session
Synthesize the associated stack to the session.
protected synthesizeStackTemplate(stack, session)
protected synthesizeStackTemplate(stack: Stack, session: ISynthesisSession): void
Parameters
- stack
Stack
- session
ISynthesis
Session
Synthesize the stack template to the given session, passing the configured lookup role ARN.