DefaultStackSynthesizer

class aws_cdk.core.DefaultStackSynthesizer(*, cloud_formation_execution_role=None, deploy_role_arn=None, file_asset_key_arn_export_name=None, file_asset_publishing_external_id=None, file_asset_publishing_role_arn=None, file_assets_bucket_name=None, image_asset_publishing_external_id=None, image_asset_publishing_role_arn=None, image_assets_repository_name=None, qualifier=None)

Bases: object

Uses conventionally named roles and reify asset storage locations.

This synthesizer is the only StackSynthesizer that generates an asset manifest, and is required to deploy CDK applications using the @aws-cdk/app-delivery CI/CD library.

Requires the environment to have been bootstrapped with Bootstrap Stack V2.

__init__(*, cloud_formation_execution_role=None, deploy_role_arn=None, file_asset_key_arn_export_name=None, file_asset_publishing_external_id=None, file_asset_publishing_role_arn=None, file_assets_bucket_name=None, image_asset_publishing_external_id=None, image_asset_publishing_role_arn=None, image_assets_repository_name=None, qualifier=None)
Parameters
  • cloud_formation_execution_role (Optional[str]) – The role CloudFormation will assume when deploying the Stack. You must supply this if you have given a non-standard name to the execution role. The placeholders ${Qualifier}, ${AWS::AccountId} and ${AWS::Region} will be replaced with the values of qualifier and the stack’s account and region, respectively. Default: DefaultStackSynthesizer.DEFAULT_CLOUDFORMATION_ROLE_ARN

  • deploy_role_arn (Optional[str]) – The role to assume to initiate a deployment in this environment. You must supply this if you have given a non-standard name to the publishing role. The placeholders ${Qualifier}, ${AWS::AccountId} and ${AWS::Region} will be replaced with the values of qualifier and the stack’s account and region, respectively. Default: DefaultStackSynthesizer.DEFAULT_DEPLOY_ROLE_ARN

  • file_asset_key_arn_export_name (Optional[str]) – Name of the CloudFormation Export with the asset key name. You must supply this if you have given a non-standard name to the KMS key export The placeholders ${Qualifier}, ${AWS::AccountId} and ${AWS::Region} will be replaced with the values of qualifier and the stack’s account and region, respectively. Default: DefaultStackSynthesizer.DEFAULT_FILE_ASSET_KEY_ARN_EXPORT_NAME

  • file_asset_publishing_external_id (Optional[str]) – External ID to use when assuming role for file asset publishing. Default: - No external ID

  • file_asset_publishing_role_arn (Optional[str]) – The role to use to publish file assets to the S3 bucket in this environment. You must supply this if you have given a non-standard name to the publishing role. The placeholders ${Qualifier}, ${AWS::AccountId} and ${AWS::Region} will be replaced with the values of qualifier and the stack’s account and region, respectively. Default: DefaultStackSynthesizer.DEFAULT_FILE_ASSET_PUBLISHING_ROLE_ARN

  • file_assets_bucket_name (Optional[str]) – Name of the S3 bucket to hold file assets. You must supply this if you have given a non-standard name to the staging bucket. The placeholders ${Qualifier}, ${AWS::AccountId} and ${AWS::Region} will be replaced with the values of qualifier and the stack’s account and region, respectively. Default: DefaultStackSynthesizer.DEFAULT_FILE_ASSETS_BUCKET_NAME

  • image_asset_publishing_external_id (Optional[str]) – External ID to use when assuming role for image asset publishing. Default: - No external ID

  • image_asset_publishing_role_arn (Optional[str]) – The role to use to publish image assets to the ECR repository in this environment. You must supply this if you have given a non-standard name to the publishing role. The placeholders ${Qualifier}, ${AWS::AccountId} and ${AWS::Region} will be replaced with the values of qualifier and the stack’s account and region, respectively. Default: DefaultStackSynthesizer.DEFAULT_IMAGE_ASSET_PUBLISHING_ROLE_ARN

  • image_assets_repository_name (Optional[str]) – Name of the ECR repository to hold Docker Image assets. You must supply this if you have given a non-standard name to the ECR repository. The placeholders ${Qualifier}, ${AWS::AccountId} and ${AWS::Region} will be replaced with the values of qualifier and the stack’s account and region, respectively. Default: DefaultStackSynthesizer.DEFAULT_IMAGE_ASSETS_REPOSITORY_NAME

  • qualifier (Optional[str]) – Qualifier to disambiguate multiple environments in the same account. You can use this and leave the other naming properties empty if you have deployed the bootstrap environment with standard names but only differnet qualifiers. Default: - Value of context key ‘

Return type

None

Methods

add_docker_image_asset(*, directory_name, source_hash, docker_build_args=None, docker_build_target=None, docker_file=None, repository_name=None)

Register a Docker Image Asset.

Returns the parameters that can be used to refer to the asset inside the template.

Parameters
  • directory_name (str) – The directory where the Dockerfile is stored, must be relative to the cloud assembly root.

  • source_hash (str) – The hash of the contents of the docker build context. This hash is used throughout the system to identify this image and avoid duplicate work in case the source did not change. NOTE: this means that if you wish to update your docker image, you must make a modification to the source (e.g. add some metadata to your Dockerfile).

  • docker_build_args (Optional[Mapping[str, str]]) – Build args to pass to the docker build command. Since Docker build arguments are resolved before deployment, keys and values cannot refer to unresolved tokens (such as lambda.functionArn or queue.queueUrl). Default: - no build args are passed

  • docker_build_target (Optional[str]) – Docker target to build to. Default: - no target

  • docker_file (Optional[str]) – Path to the Dockerfile (relative to the directory). Default: - no file

  • repository_name (Optional[str]) – ECR repository name. Specify this property if you need to statically address the image, e.g. from a Kubernetes Pod. Note, this is only the repository name, without the registry and the tag parts. Default: - automatically derived from the asset’s ID.

Return type

DockerImageAssetLocation

add_file_asset(*, file_name, packaging, source_hash)

Register a File Asset.

Returns the parameters that can be used to refer to the asset inside the template.

Parameters
  • file_name (str) – The path, relative to the root of the cloud assembly, in which this asset source resides. This can be a path to a file or a directory, dependning on the packaging type.

  • packaging (FileAssetPackaging) – Which type of packaging to perform.

  • source_hash (str) – A hash on the content source. This hash is used to uniquely identify this asset throughout the system. If this value doesn’t change, the asset will not be rebuilt or republished.

Return type

FileAssetLocation

bind(stack)

Bind to the stack this environment is going to be used on.

Must be called before any of the other methods are called.

Parameters

stack (Stack) –

Return type

None

synthesize_stack_artifacts(session)

Synthesize all artifacts required for the stack into the session.

Parameters

session (ISynthesisSession) –

Return type

None

Attributes

DEFAULT_CLOUDFORMATION_ROLE_ARN = 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-cfn-exec-role-${AWS::AccountId}-${AWS::Region}'
DEFAULT_DEPLOY_ROLE_ARN = 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-deploy-role-${AWS::AccountId}-${AWS::Region}'
DEFAULT_FILE_ASSETS_BUCKET_NAME = 'cdk-${Qualifier}-assets-${AWS::AccountId}-${AWS::Region}'
DEFAULT_FILE_ASSET_KEY_ARN_EXPORT_NAME = 'CdkBootstrap-${Qualifier}-FileAssetKeyArn'
DEFAULT_FILE_ASSET_PUBLISHING_ROLE_ARN = 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-file-publishing-role-${AWS::AccountId}-${AWS::Region}'
DEFAULT_IMAGE_ASSETS_REPOSITORY_NAME = 'cdk-${Qualifier}-container-assets-${AWS::AccountId}-${AWS::Region}'
DEFAULT_IMAGE_ASSET_PUBLISHING_ROLE_ARN = 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-image-publishing-role-${AWS::AccountId}-${AWS::Region}'
DEFAULT_QUALIFIER = 'hnb659fds'
cloud_formation_execution_role_arn

Returns the ARN of the CFN execution Role.

Return type

str

deploy_role_arn

Returns the ARN of the deploy Role.

Return type

str