• 沒有找到結果。

Changing the resource names

Java

new MyStack(app, "MyStack", StackProps.builder() .synthesizer(DefaultStackSynthesizer.Builder.create() .qualifier("MYQUALIFIER")

.build()) .build();

C#

new MyStack(app, "MyStack", new StackProps

{ Synthesizer = new DefaultStackSynthesizer(new DefaultStackSynthesizerProps {

Qualifier = "MYQUALIFIER"

}) });

Or by configuring the qualifier as a context key in cdk.json.

{ "app": "...", "context": {

"@aws-cdk/core:bootstrapQualifier": "MYQUALIFIER"

} }

Changing the resource names

All the other DefaultStackSynthesizer properties relate to the names of the resources in the bootstrapping template. You only need to provide any of these properties if you modified the bootstrap template and changed the resource names or naming scheme.

All properties accept the special placeholders ${Qualifier}, ${AWS::Partition},

${AWS::AccountId}, and ${AWS::Region}. These placeholders are replaced with the values of the qualifier parameter and with the values of the AWS partition, account ID, and region for the stack's environment, respectively.

The following example shows all the available properties for DefaultStackSynthesizer along with their default values, as if you were instantiating the synthesizer.

TypeScript

new DefaultStackSynthesizer({

// Name of the S3 bucket for file assets

fileAssetsBucketName: 'cdk-${Qualifier}-assets-${AWS::AccountId}-${AWS::Region}', bucketPrefix: '',

// Name of the ECR repository for Docker image assets

imageAssetsRepositoryName:

'cdk-${Qualifier}-container-assets-${AWS::AccountId}-${AWS::Region}',

// ARN of the role assumed by the CLI and Pipeline to deploy here

deployRoleArn: 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-deploy-role-${AWS::AccountId}-${AWS::Region}',

Customizing synthesis

deployRoleExternalId: '',

// ARN of the role used for file asset publishing (assumed from the deploy role) fileAssetPublishingRoleArn:

'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-file-publishing-role-${AWS::AccountId}-${AWS::Region}', fileAssetPublishingExternalId: '',

// ARN of the role used for Docker asset publishing (assumed from the deploy role) imageAssetPublishingRoleArn:

'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-image-publishing-role-${AWS::AccountId}-${AWS::Region}', imageAssetPublishingExternalId: '',

// ARN of the role passed to CloudFormation to execute the deployments

cloudFormationExecutionRole:

'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-cfn-exec-role-${AWS::AccountId}-${AWS::Region}',

// Name of the SSM parameter which describes the bootstrap stack version number bootstrapStackVersionSsmParameter: '/cdk-bootstrap/${Qualifier}/version',

// Add a rule to every template which verifies the required bootstrap stack version generateBootstrapVersionRule: true,

// Name of the ECR repository for Docker image assets

imageAssetsRepositoryName:

'cdk-${Qualifier}-container-assets-${AWS::AccountId}-${AWS::Region}',

// ARN of the role assumed by the CLI and Pipeline to deploy here

deployRoleArn: 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-deploy-role-${AWS::AccountId}-${AWS::Region}',

deployRoleExternalId: '',

// ARN of the role used for file asset publishing (assumed from the deploy role) fileAssetPublishingRoleArn:

'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-file-publishing-role-${AWS::AccountId}-${AWS::Region}', fileAssetPublishingExternalId: '',

// ARN of the role used for Docker asset publishing (assumed from the deploy role) imageAssetPublishingRoleArn:

'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-image-publishing-role-${AWS::AccountId}-${AWS::Region}', imageAssetPublishingExternalId: '',

// ARN of the role passed to CloudFormation to execute the deployments

cloudFormationExecutionRole:

'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-cfn-exec-role-${AWS::AccountId}-${AWS::Region}',

// Name of the SSM parameter which describes the bootstrap stack version number bootstrapStackVersionSsmParameter: '/cdk-bootstrap/${Qualifier}/version',

// Add a rule to every template which verifies the required bootstrap stack version generateBootstrapVersionRule: true,

}) Python

DefaultStackSynthesizer(

# Name of the S3 bucket for file assets

Customizing synthesis

file_assets_bucket_name="cdk-${Qualifier}-assets-${AWS::AccountId}-${AWS::Region}", bucket_prefix="",

# Name of the ECR repository for Docker image assets

image_assets_repository_name="cdk-${Qualifier}-container-assets-${AWS::AccountId}-${AWS::Region}",

# ARN of the role assumed by the CLI and Pipeline to deploy here

deploy_role_arn="arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-deploy-role-${AWS::AccountId}-${AWS::Region}",

deploy_role_external_id="",

# ARN of the role used for file asset publishing (assumed from the deploy role) file_asset_publishing_role_arn="arn:${AWS::Partition}:iam::${AWS::AccountId}:role/

cdk-${Qualifier}-file-publishing-role-${AWS::AccountId}-${AWS::Region}", file_asset_publishing_external_id="",

# ARN of the role used for Docker asset publishing (assumed from the deploy role) image_asset_publishing_role_arn="arn:${AWS::Partition}:iam::${AWS::AccountId}:role/

cdk-${Qualifier}-image-publishing-role-${AWS::AccountId}-${AWS::Region}", image_asset_publishing_external_id="",

# ARN of the role passed to CloudFormation to execute the deployments

cloud_formation_execution_role="arn:${AWS::Partition}:iam::${AWS::AccountId}:role/

cdk-${Qualifier}-cfn-exec-role-${AWS::AccountId}-${AWS::Region}"

# Name of the SSM parameter which describes the bootstrap stack version number bootstrap_stack_version_ssm_parameter="/cdk-bootstrap/${Qualifier}/version", # Add a rule to every template which verifies the required bootstrap stack version generate_bootstrap_version_rule=True,

) Java

DefaultStackSynthesizer.Builder.create() // Name of the S3 bucket for file assets

.fileAssetsBucketName("cdk-${Qualifier}-assets-${AWS::AccountId}-${AWS::Region}") .bucketPrefix('')

// Name of the ECR repository for Docker image assets

.imageAssetsRepositoryName("cdk-${Qualifier}-container-assets-${AWS::AccountId}-${AWS::Region}")

// ARN of the role assumed by the CLI and Pipeline to deploy here

.deployRoleArn("arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-deploy-role-${AWS::AccountId}-${AWS::Region}")

.deployRoleExternalId("")

// ARN of the role used for file asset publishing (assumed from the deploy role)

.fileAssetPublishingRoleArn("arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-file-publishing-role-${AWS::AccountId}-${AWS::Region}") .fileAssetPublishingExternalId("")

// ARN of the role used for Docker asset publishing (assumed from the deploy role) .imageAssetPublishingRoleArn("arn:${AWS::Partition}:iam::${AWS::AccountId}:role/

cdk-${Qualifier}-image-publishing-role-${AWS::AccountId}-${AWS::Region}") .imageAssetPublishingExternalId("")

// ARN of the role passed to CloudFormation to execute the deployments

.cloudFormationExecutionRole("arn:${AWS::Partition}:iam::${AWS::AccountId}:role/

cdk-${Qualifier}-cfn-exec-role-${AWS::AccountId}-${AWS::Region}")

// Name of the SSM parameter which describes the bootstrap stack version number .bootstrapStackVersionSsmParameter("/cdk-bootstrap/${Qualifier}/version")

相關文件