Skip to content

(toolkit-lib): Add programmatic API to get CDK bootstrap template #1010

@JohannesKonings

Description

@JohannesKonings

Describe the feature

Currently, @aws-cdk/toolkit-lib does not expose a programmatic interface to generate the CDK bootstrap template. Users must rely on the CLI command cdk bootstrap --show-template to obtain the CloudFormation template.

Use Case

Get the template and modificate it (e.g. add a log bucket for the asset bucket access logs) and bootstrap an environment in one typescript script

Proposed Solution

Somehow like this

const cdk = new Toolkit();
const bootstrapTemplate = await cdk.bootstrap.showTemplate();

Other Information

fallback to the cli

const resultCdkStandardTemplate = execSync('pnpm exec cdk bootstrap --show-template', {
    encoding: 'utf8',
  });

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

@aws-cdk/[email protected]

Environment details (OS name and version, etc.)

linux

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions