Skip to content

Latest commit

 

History

History

cdk-cli-wrapper

cdk-cli-wrapper


cdk-constructs: Experimental

The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


CDK CLI Wrapper Library.

Internal only for now.

Overview

This package provides a library which wraps the CDK CLI, allowing you to interact with the CLI programmatically.

Currently this package provides wrappers for:

  • cdk deploy
  • cdk synth
  • cdk destroy
  • cdk list

Usage

First create a new CdkCliWrapper with the directory in which you want to execute commands, and optionally any environment variables that you want to include in the execution environment.

new CdkCliWrapper({
  directory: '/path/to/project',
  env: {
    KEY: 'value',
  },
});

deploy

const cdk = new CdkCliWrapper({
  directory: '/project/path',
});

cdk.deploy({
  app: 'node bin/my-app.js',
  stacks: ['my-test-stack'],
});

synth

const cdk = new CdkCliWrapper({
  directory: '/project/path',
});

cdk.synth({
  app: 'node bin/my-app.js',
  stacks: ['my-test-stack'],
});

destroy

const cdk = new CdkCliWrapper({
  directory: '/project/path',
});

cdk.destroy({
  app: 'node bin/my-app.js',
  stacks: ['my-test-stack'],
});

list

const cdk = new CdkCliWrapper({
  directory: '/project/path',
});

cdk.list({
  app: 'node bin/my-app.js',
  stacks: ['*'],
});