Class DefaultStackSynthesizer

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.StackSynthesizer
software.amazon.awscdk.DefaultStackSynthesizer
All Implemented Interfaces:
IBoundStackSynthesizer, IReusableStackSynthesizer, IStackSynthesizer, software.amazon.jsii.JsiiSerializable
Direct Known Subclasses:
BootstraplessSynthesizer

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:01.574Z") @Stability(Stable) public class DefaultStackSynthesizer extends StackSynthesizer implements IReusableStackSynthesizer, IBoundStackSynthesizer
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:

 App app;
 Stage prodStage = Stage.Builder.create(app, "ProdStage")
         .permissionsBoundary(PermissionsBoundary.fromName("cdk-${Qualifier}-PermissionsBoundary-${AWS::AccountId}-${AWS::Region}"))
         .build();
 Stack.Builder.create(prodStage, "ProdStack")
         .synthesizer(DefaultStackSynthesizer.Builder.create()
                 .qualifier("custom")
                 .build())
         .build();
 
  • Field Details

    • DEFAULT_BOOTSTRAP_STACK_VERSION_SSM_PARAMETER

      @Stability(Stable) public static final String DEFAULT_BOOTSTRAP_STACK_VERSION_SSM_PARAMETER
      Default bootstrap stack version SSM parameter.
    • DEFAULT_CLOUDFORMATION_ROLE_ARN

      @Stability(Stable) public static final String DEFAULT_CLOUDFORMATION_ROLE_ARN
      Default CloudFormation role ARN.
    • DEFAULT_DEPLOY_ROLE_ARN

      @Stability(Stable) public static final String DEFAULT_DEPLOY_ROLE_ARN
      Default deploy role ARN.
    • DEFAULT_DOCKER_ASSET_PREFIX

      @Stability(Stable) public static final String DEFAULT_DOCKER_ASSET_PREFIX
      Default Docker asset prefix.
    • DEFAULT_FILE_ASSET_KEY_ARN_EXPORT_NAME

      @Stability(Stable) public static final String DEFAULT_FILE_ASSET_KEY_ARN_EXPORT_NAME
      Name of the CloudFormation Export with the asset key name.
    • DEFAULT_FILE_ASSET_PREFIX

      @Stability(Stable) public static final String DEFAULT_FILE_ASSET_PREFIX
      Default file asset prefix.
    • DEFAULT_FILE_ASSET_PUBLISHING_ROLE_ARN

      @Stability(Stable) public static final String DEFAULT_FILE_ASSET_PUBLISHING_ROLE_ARN
      Default asset publishing role ARN for file (S3) assets.
    • DEFAULT_FILE_ASSETS_BUCKET_NAME

      @Stability(Stable) public static final String DEFAULT_FILE_ASSETS_BUCKET_NAME
      Default file assets bucket name.
    • DEFAULT_IMAGE_ASSET_PUBLISHING_ROLE_ARN

      @Stability(Stable) public static final String DEFAULT_IMAGE_ASSET_PUBLISHING_ROLE_ARN
      Default asset publishing role ARN for image (ECR) assets.
    • DEFAULT_IMAGE_ASSETS_REPOSITORY_NAME

      @Stability(Stable) public static final String DEFAULT_IMAGE_ASSETS_REPOSITORY_NAME
      Default image assets repository name.
    • DEFAULT_LOOKUP_ROLE_ARN

      @Stability(Stable) public static final String DEFAULT_LOOKUP_ROLE_ARN
      Default lookup role ARN for missing values.
    • DEFAULT_QUALIFIER

      @Stability(Stable) public static final String DEFAULT_QUALIFIER
      Default ARN qualifier.
  • Constructor Details

    • DefaultStackSynthesizer

      protected DefaultStackSynthesizer(software.amazon.jsii.JsiiObjectRef objRef)
    • DefaultStackSynthesizer

      protected DefaultStackSynthesizer(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • DefaultStackSynthesizer

      @Stability(Stable) public DefaultStackSynthesizer(@Nullable DefaultStackSynthesizerProps props)
      Parameters:
      props -
    • DefaultStackSynthesizer

      @Stability(Stable) public DefaultStackSynthesizer()
  • Method Details

    • addDockerImageAsset

      @Stability(Stable) @NotNull public DockerImageAssetLocation addDockerImageAsset(@NotNull DockerImageAssetSource asset)
      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.

      Specified by:
      addDockerImageAsset in interface IStackSynthesizer
      Specified by:
      addDockerImageAsset in class StackSynthesizer
      Parameters:
      asset - This parameter is required.
    • addFileAsset

      @Stability(Stable) @NotNull public FileAssetLocation addFileAsset(@NotNull FileAssetSource asset)
      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.

      Specified by:
      addFileAsset in interface IStackSynthesizer
      Specified by:
      addFileAsset in class StackSynthesizer
      Parameters:
      asset - This parameter is required.
    • bind

      @Stability(Stable) public void bind(@NotNull 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.

      Specified by:
      bind in interface IStackSynthesizer
      Overrides:
      bind in class StackSynthesizer
      Parameters:
      stack - This parameter is required.
    • reusableBind

      @Stability(Stable) @NotNull public IBoundStackSynthesizer reusableBind(@NotNull Stack stack)
      Produce a bound Stack Synthesizer for the given stack.

      This method may be called more than once on the same object.

      Specified by:
      reusableBind in interface IReusableStackSynthesizer
      Parameters:
      stack - This parameter is required.
    • synthesize

      @Stability(Stable) public void synthesize(@NotNull ISynthesisSession session)
      Synthesize the associated stack to the session.

      Specified by:
      synthesize in interface IStackSynthesizer
      Specified by:
      synthesize in class StackSynthesizer
      Parameters:
      session - This parameter is required.
    • synthesizeStackTemplate

      @Stability(Stable) protected void synthesizeStackTemplate(@NotNull Stack stack, @NotNull ISynthesisSession session)
      Synthesize the stack template to the given session, passing the configured lookup role ARN.

      Overrides:
      synthesizeStackTemplate in class StackSynthesizer
      Parameters:
      stack - This parameter is required.
      session - This parameter is required.
    • getCloudFormationExecutionRoleArn

      @Stability(Stable) @NotNull public String getCloudFormationExecutionRoleArn()
      Returns the ARN of the CFN execution Role.
    • getDeployRoleArn

      @Stability(Stable) @NotNull public String getDeployRoleArn()
      Returns the ARN of the deploy Role.
    • getBootstrapQualifier

      @Stability(Stable) @Nullable public String getBootstrapQualifier()
      The qualifier used to bootstrap this stack.
      Specified by:
      getBootstrapQualifier in interface IStackSynthesizer
      Overrides:
      getBootstrapQualifier in class StackSynthesizer
    • getLookupRole

      @Stability(Stable) @Nullable public String getLookupRole()
      The role used to lookup for this stack.
      Specified by:
      getLookupRole in interface IStackSynthesizer
      Overrides:
      getLookupRole in class StackSynthesizer
    • getStack

      @Stability(Deprecated) @Deprecated @Nullable protected Stack getStack()
      Deprecated.
      Use boundStack instead.
      (deprecated) Return the currently bound stack.