class StackSynthesizer
Language | Type name |
---|---|
.NET | Amazon.CDK.StackSynthesizer |
Go | github.com/aws/aws-cdk-go/awscdk/v2#StackSynthesizer |
Java | software.amazon.awscdk.StackSynthesizer |
Python | aws_cdk.StackSynthesizer |
TypeScript (source) | aws-cdk-lib » StackSynthesizer |
Implements
IStack
Implemented by
App
, Bootstrapless
, Cli
, Default
, Legacy
, Nested
Base class for implementing an IStackSynthesizer.
This class needs to exist to provide public surface area for external implementations of stack synthesizers. The protected methods give access to functions that are otherwise
Initializer
new StackSynthesizer()
Properties
Name | Type | Description |
---|---|---|
bound | Stack | Retrieve the bound stack. |
bootstrap | string | The qualifier used to bootstrap this stack. |
lookup | string | The role used to lookup for this stack. |
boundStack
Type:
Stack
Retrieve the bound stack.
Fails if the stack hasn't been bound yet.
bootstrapQualifier?
Type:
string
(optional)
The qualifier used to bootstrap this stack.
lookupRole?
Type:
string
(optional)
The role used to lookup for this stack.
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. |
synthesize(session) | Synthesize the associated stack to the session. |
protected add | Add a CfnRule to the bound stack that checks whether an SSM parameter exceeds a given version. |
protected cloud | Turn a docker asset location into a CloudFormation representation of that location. |
protected cloud | Turn a file asset location into a CloudFormation representation of that location. |
protected emit | Write the CloudFormation stack artifact to the session. |
protected emit | Write the stack artifact to the session. |
protected synthesize | Have the stack write out its template. |
protected synthesize | Write the stack template to the given session. |
DockerImageAsset(asset)
addpublic 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.
FileAsset(asset)
addpublic 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.
synthesize(session)
public synthesize(session: ISynthesisSession): void
Parameters
- session
ISynthesis
Session
Synthesize the associated stack to the session.
BootstrapVersionRule(requiredVersion, bootstrapStackVersionSsmParameter)
protected addprotected addBootstrapVersionRule(requiredVersion: number, bootstrapStackVersionSsmParameter: string): void
Parameters
- requiredVersion
number
- bootstrapStackVersionSsmParameter
string
Add a CfnRule to the bound stack that checks whether an SSM parameter exceeds a given version.
This will modify the template, so must be called before the stack is synthesized.
FormationLocationFromDockerImageAsset(dest)
protected cloudprotected cloudFormationLocationFromDockerImageAsset(dest: DockerImageDestination): DockerImageAssetLocation
Parameters
Returns
Turn a docker asset location into a CloudFormation representation of that location.
If any of the fields contain placeholders, the result will be wrapped in a Fn.sub
.
FormationLocationFromFileAsset(location)
protected cloudprotected cloudFormationLocationFromFileAsset(location: FileDestination): FileAssetLocation
Parameters
- location
File
Destination
Returns
Turn a file asset location into a CloudFormation representation of that location.
If any of the fields contain placeholders, the result will be wrapped in a Fn.sub
.
Artifact(session, options?)
protected emitprotected emitArtifact(session: ISynthesisSession, options?: SynthesizeStackArtifactOptions): void
Parameters
- session
ISynthesis
Session - options
Synthesize
Stack Artifact Options
Write the CloudFormation stack artifact to the session.
Use default settings to add a CloudFormationStackArtifact artifact to the given synthesis session. The Stack artifact will control the settings for the CloudFormation deployment.
StackArtifact(stack, session, options?)
protected emitprotected emitStackArtifact(stack: Stack, session: ISynthesisSession, options?: SynthesizeStackArtifactOptions): void
⚠️ Deprecated: Use emitArtifact
instead
Parameters
- stack
Stack
- session
ISynthesis
Session - options
Synthesize
Stack Artifact Options
Write the stack artifact to the session.
Use default settings to add a CloudFormationStackArtifact artifact to the given synthesis session.
StackTemplate(stack, session)
protected synthesizeprotected synthesizeStackTemplate(stack: Stack, session: ISynthesisSession): void
⚠️ Deprecated: Use synthesizeTemplate
instead
Parameters
- stack
Stack
- session
ISynthesis
Session
Have the stack write out its template.
Template(session, lookupRoleArn?, lookupRoleExternalId?, lookupRoleAdditionalOptions?)
protected synthesizeprotected synthesizeTemplate(session: ISynthesisSession, lookupRoleArn?: string, lookupRoleExternalId?: string, lookupRoleAdditionalOptions?: { [string]: any }): FileAssetSource
Parameters
- session
ISynthesis
Session - lookupRoleArn
string
- lookupRoleExternalId
string
- lookupRoleAdditionalOptions
{ [string]: any }
Returns
Write the stack template to the given session.
Return a descriptor that represents the stack template as a file asset
source, for adding to an asset manifest (if desired). This can be used to
have the asset manifest system (cdk-assets
) upload the template to S3
using the appropriate role, so that afterwards only a CloudFormation
deployment is necessary.
If the template is uploaded as an asset, the stackTemplateAssetObjectUrl
property should be set when calling emitArtifact.
If the template is NOT uploaded as an asset first and the template turns
out to be >50KB, it will need to be uploaded to S3 anyway. At that point
the credentials will be the same identity that is doing the UpdateStack
call, which may not have the right permissions to write to S3.