# @aws-cdk/cli-lib-alpha

> AWS CDK Programmatic CLI library

Latest version **2.1029.4-alpha.0** (published 2025-10-01) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @aws-cdk/cli-lib-alpha
pnpm add @aws-cdk/cli-lib-alpha
yarn add @aws-cdk/cli-lib-alpha
bun add @aws-cdk/cli-lib-alpha
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.1029.4-alpha.0 |
| Published | 2025-10-01 |
| First published | 2023-01-19 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 18.0.0 |
| Dependencies | 0 |
| Unpacked size | 19.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 105 |
| Author | Amazon Web Services |
| Maintainers | amzn-oss, aws-cdk-team |
| Keywords | aws, cdk |

## Links

- npm: https://www.npmjs.com/package/@aws-cdk/cli-lib-alpha
- Repository: https://github.com/aws/aws-cdk-cli
- Homepage: https://github.com/aws/aws-cdk
- Issues: https://github.com/aws/aws-cdk-cli/issues
- npm.io page: https://npm.io/package/@aws-cdk/cli-lib-alpha

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 2.1029.4-alpha.0 (latest) — 2025-10-01
- 2.1029.3-alpha.0 — 2025-09-24
- 2.1029.2-alpha.0 — 2025-09-17
- 2.1029.1-alpha.0 — 2025-09-11
- 2.1029.0-alpha.0 — 2025-09-05
- 2.1028.0-alpha.0 — 2025-09-03
- 2.1027.0-alpha.0 — 2025-08-27
- 2.1026.0-alpha.0 — 2025-08-22
- 2.1025.0-alpha.0 — 2025-08-14
- 2.1024.0-alpha.0 — 2025-08-06
- 2.1023.0-alpha.0 — 2025-07-29
- 2.1022.0-alpha.0 — 2025-07-24
- 2.1021.0-alpha.0 — 2025-07-16
- 2.1020.2-alpha.0 — 2025-07-03
- 2.1020.1-alpha.0 — 2025-07-02
- … 199 more at https://npm.io/package/@aws-cdk/cli-lib-alpha/versions

## README

# AWS CDK CLI Library (deprecated)

<!--BEGIN STABILITY BANNER-->

---

![@aws-cdk/cli-lib-lpha: Deprecated](https://img.shields.io/badge/@aws--cdk/cli--lib--alpha-deprectated-red.svg?style=for-the-badge)

> This package has been deprecated in favor of [@aws-cdk/toolkit-lib](https://github.com/aws/aws-cdk-cli/issues/155),
> a newer approach providing similar functionality to what this package offered.
> Please migrate as soon as possible.
> For any migration problems, please open [an issue](https://github.com/aws/aws-cdk-cli/issues/new/choose).
> We are committed to supporting the same feature set that this package offered.

---

<!--END STABILITY BANNER-->

## ⚠️ Deprecated module

This package is has been deprecated.
Already published versions can be used, but no support is provided whatsoever and we will soon stop publishing new versions.

Instead, please use [@aws-cdk/toolkit-lib](https://github.com/aws/aws-cdk-cli/issues/155).

## Overview

Provides a library to interact with the AWS CDK CLI programmatically from jsii supported languages.
Currently the package includes implementations for:

- `cdk deploy`
- `cdk synth`
- `cdk bootstrap`
- `cdk destroy`
- `cdk list`

## Known issues

- **JavaScript/TypeScript only**\
  The jsii packages are currently not in a working state.
- **No useful return values**\
  All output is currently printed to stdout/stderr
- **Missing or Broken options**\
  Some CLI options might not be available in this package or broken

Due to the deprecation of the package, this issues will not be resolved.

## Setup

### AWS CDK app directory

Obtain an `AwsCdkCli` class from an AWS CDK app directory (containing a `cdk.json` file):

```ts fixture=imports
const cli = AwsCdkCli.fromCdkAppDirectory("/path/to/cdk/app");
```

### Cloud Assembly Directory Producer

You can also create `AwsCdkCli` from a class implementing `ICloudAssemblyDirectoryProducer`.
AWS CDK apps might need to be synthesized multiple times with additional context values before they are ready.

The `produce()` method of the `ICloudAssemblyDirectoryProducer` interface provides this multi-pass ability.
It is invoked with the context values of the current iteration and should use these values to synthesize a Cloud Assembly.
The return value is the path to the assembly directory.

A basic implementation would look like this:

```ts fixture=imports
class MyProducer implements ICloudAssemblyDirectoryProducer {
  async produce(context: Record<string, any>) {
    const app = new cdk.App({ context });
    const stack = new cdk.Stack(app);
    return app.synth().directory;
  }
}
```

For all features (e.g. lookups) to work correctly, `cdk.App()` must be instantiated with the received `context` values.
Since it is not possible to update the context of an app, it must be created as part of the `produce()` method.

The producer can than be used like this:

```ts fixture=producer
const cli = AwsCdkCli.fromCloudAssemblyDirectoryProducer(new MyProducer());
```

## Commands

### list

```ts
// await this asynchronous method call using a language feature
cli.list();
```

### synth

```ts
// await this asynchronous method call using a language feature
cli.synth({
  stacks: ['MyTestStack'],
});
```

### bootstrap

```ts
// await this asynchronous method call using a language feature
cli.bootstrap();
```

### deploy

```ts
// await this asynchronous method call using a language feature
cli.deploy({
  stacks: ['MyTestStack'],
});
```

### destroy

```ts
// await this asynchronous method call using a language feature
cli.destroy({
  stacks: ['MyTestStack'],
});
```

---
_Source: https://npm.io/package/@aws-cdk/cli-lib-alpha · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
