aws-cdk 2.1020.2 → 2.1022.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -55
- package/THIRD_PARTY_LICENSES +65 -65
- package/build-info.json +2 -2
- package/db.json.gz +0 -0
- package/lib/api/refactor.d.ts +1 -0
- package/lib/api/refactor.js +8 -0
- package/lib/cli/cdk-toolkit.d.ts +19 -21
- package/lib/cli/cdk-toolkit.js +145 -141
- package/lib/cli/cli-config.js +19 -13
- package/lib/cli/cli-type-registry.json +29 -12
- package/lib/cli/cli.js +76 -22
- package/lib/cli/convert-to-user-input.js +16 -6
- package/lib/cli/display-version.d.ts +11 -0
- package/lib/cli/display-version.js +101 -0
- package/lib/cli/io-host/cli-io-host.d.ts +11 -11
- package/lib/cli/io-host/cli-io-host.js +68 -24
- package/lib/cli/parse-command-line-arguments.js +29 -11
- package/lib/cli/platform-warnings.d.ts +2 -1
- package/lib/cli/platform-warnings.js +3 -4
- package/lib/cli/telemetry/collect-telemetry.d.ts +5 -0
- package/lib/cli/telemetry/collect-telemetry.js +15 -0
- package/lib/cli/telemetry/endpoint-sink.d.ts +1 -2
- package/lib/cli/telemetry/endpoint-sink.js +4 -3
- package/lib/cli/telemetry/error.d.ts +2 -0
- package/lib/cli/telemetry/error.js +16 -0
- package/lib/cli/telemetry/feature-flags.d.ts +96 -0
- package/lib/cli/telemetry/feature-flags.js +103 -0
- package/lib/cli/telemetry/file-sink.js +8 -12
- package/lib/cli/telemetry/installation-id.d.ts +5 -0
- package/lib/cli/telemetry/installation-id.js +47 -0
- package/lib/cli/telemetry/library-version.d.ts +2 -0
- package/lib/cli/telemetry/library-version.js +30 -0
- package/lib/cli/telemetry/messages.d.ts +40 -0
- package/lib/cli/telemetry/messages.js +65 -0
- package/lib/cli/telemetry/sanitation.d.ts +100 -0
- package/lib/cli/telemetry/sanitation.js +79 -0
- package/lib/cli/telemetry/schema.d.ts +47 -19
- package/lib/cli/telemetry/schema.js +10 -1
- package/lib/cli/telemetry/session.d.ts +33 -0
- package/lib/cli/telemetry/session.js +130 -0
- package/lib/cli/user-configuration.d.ts +14 -4
- package/lib/cli/user-configuration.js +42 -30
- package/lib/cli/user-input.d.ts +31 -13
- package/lib/cli/user-input.js +1 -1
- package/lib/cli/util/ci.d.ts +5 -0
- package/lib/cli/util/ci.js +11 -0
- package/lib/cli/util/yargs-helpers.d.ts +1 -1
- package/lib/cli/util/yargs-helpers.js +7 -7
- package/lib/cli/version.d.ts +2 -12
- package/lib/cli/version.js +5 -103
- package/lib/commands/context.d.ts +10 -5
- package/lib/commands/context.js +35 -35
- package/lib/commands/docs.d.ts +6 -1
- package/lib/commands/docs.js +20 -19
- package/lib/commands/doctor.d.ts +4 -1
- package/lib/commands/doctor.js +17 -17
- package/lib/commands/flags.d.ts +3 -0
- package/lib/commands/flags.js +43 -0
- package/lib/commands/init/init-hooks.d.ts +2 -1
- package/lib/commands/init/init-hooks.js +6 -6
- package/lib/commands/init/init.d.ts +4 -2
- package/lib/commands/init/init.js +56 -54
- package/lib/commands/init/os.d.ts +2 -1
- package/lib/commands/init/os.js +3 -4
- package/lib/commands/list-stacks.js +8 -2
- package/lib/commands/migrate.d.ts +6 -17
- package/lib/commands/migrate.js +28 -29
- package/lib/cxapp/cloud-assembly.js +1 -1
- package/lib/cxapp/cloud-executable.js +41 -26
- package/lib/index.d.ts +1 -1
- package/lib/index.js +46764 -31086
- package/lib/index_bg.wasm +0 -0
- package/lib/init-templates/.init-version.json +1 -1
- package/lib/init-templates/.recommended-feature-flags.json +1 -0
- package/lib/{legacy-aws-auth.d.ts → legacy/aws-auth.d.ts} +1 -1
- package/lib/legacy/aws-auth.js +47 -0
- package/lib/legacy/configuration.d.ts +82 -0
- package/lib/legacy/configuration.js +321 -0
- package/lib/legacy/index.d.ts +19 -0
- package/lib/{legacy-exports-source.js → legacy/index.js} +23 -23
- package/lib/{legacy-logging-source.d.ts → legacy/logging.d.ts} +50 -0
- package/lib/legacy/logging.js +154 -0
- package/lib/legacy/types.js +3 -0
- package/lib/legacy-exports.d.ts +4 -3
- package/lib/legacy-exports.js +4 -1
- package/package.json +15 -15
- package/lib/legacy-aws-auth.js +0 -47
- package/lib/legacy-exports-source.d.ts +0 -18
- package/lib/legacy-logging-source.js +0 -107
- package/lib/legacy-types.js +0 -3
- package/lib/logging.d.ts +0 -99
- package/lib/logging.js +0 -146
- /package/lib/{legacy-types.d.ts → legacy/types.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -11,26 +11,27 @@
|
|
|
11
11
|
|
|
12
12
|
The AWS CDK Toolkit provides the `cdk` command-line interface that can be used to work with AWS CDK applications. This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.
|
|
13
13
|
|
|
14
|
-
| Command
|
|
15
|
-
|
|
|
16
|
-
| [`cdk docs`](#cdk-docs)
|
|
17
|
-
| [`cdk init`](#cdk-init)
|
|
18
|
-
| [`cdk list`](#cdk-list)
|
|
19
|
-
| [`cdk synth`](#cdk-synth)
|
|
20
|
-
| [`cdk diff`](#cdk-diff)
|
|
21
|
-
| [`cdk deploy`](#cdk-deploy)
|
|
22
|
-
| [`cdk rollback`](#cdk-rollback)
|
|
23
|
-
| [`cdk import`](#cdk-import)
|
|
24
|
-
| [`cdk migrate`](#cdk-migrate)
|
|
25
|
-
| [`cdk watch`](#cdk-watch)
|
|
26
|
-
| [`cdk destroy`](#cdk-destroy)
|
|
27
|
-
| [`cdk bootstrap`](#cdk-bootstrap)
|
|
28
|
-
| [`cdk gc`](#cdk-gc)
|
|
29
|
-
| [`cdk doctor`](#cdk-doctor)
|
|
30
|
-
| [`cdk acknowledge`](#cdk-acknowledge)
|
|
31
|
-
| [`cdk notices`](#cdk-notices)
|
|
32
|
-
| [`cdk refactor`](#cdk-refactor)
|
|
33
|
-
| [`cdk drift`](#cdk-drift)
|
|
14
|
+
| Command | Description |
|
|
15
|
+
| ---------------------------------------- | --------------------------------------------------------------------------------- |
|
|
16
|
+
| [`cdk docs`](#cdk-docs) | Access the online documentation |
|
|
17
|
+
| [`cdk init`](#cdk-init) | Start a new CDK project (app or library) |
|
|
18
|
+
| [`cdk list`](#cdk-list) | List stacks and their dependencies in an application |
|
|
19
|
+
| [`cdk synth`](#cdk-synth) | Synthesize a CDK app to CloudFormation template(s) |
|
|
20
|
+
| [`cdk diff`](#cdk-diff) | Diff stacks against current state |
|
|
21
|
+
| [`cdk deploy`](#cdk-deploy) | Deploy a stack into an AWS account |
|
|
22
|
+
| [`cdk rollback`](#cdk-rollback) | Roll back a failed deployment |
|
|
23
|
+
| [`cdk import`](#cdk-import) | Import existing AWS resources into a CDK stack |
|
|
24
|
+
| [`cdk migrate`](#cdk-migrate) | Migrate AWS resources, CloudFormation stacks, and CloudFormation templates to CDK |
|
|
25
|
+
| [`cdk watch`](#cdk-watch) | Watches a CDK app for deployable and hotswappable changes |
|
|
26
|
+
| [`cdk destroy`](#cdk-destroy) | Deletes a stack from an AWS account |
|
|
27
|
+
| [`cdk bootstrap`](#cdk-bootstrap) | Deploy a toolkit stack to support deploying large stacks & artifacts |
|
|
28
|
+
| [`cdk gc`](#cdk-gc) | Garbage collect assets associated with the bootstrapped stack |
|
|
29
|
+
| [`cdk doctor`](#cdk-doctor) | Inspect the environment and produce information useful for troubleshooting |
|
|
30
|
+
| [`cdk acknowledge`](#cdk-acknowledge) | Acknowledge (and hide) a notice by issue number |
|
|
31
|
+
| [`cdk notices`](#cdk-notices) | List all relevant notices for the application |
|
|
32
|
+
| [`cdk refactor`](#cdk-refactor) | Moves resources between stacks or within the same stack |
|
|
33
|
+
| [`cdk drift`](#cdk-drift) | Detect drifts in the given CloudFormation stack(s) |
|
|
34
|
+
| [`cdk cli-telemetry](#cdk-cli-telemetry) | Enable or disable cli telemetry collection |
|
|
34
35
|
|
|
35
36
|
## Common topics
|
|
36
37
|
|
|
@@ -1101,8 +1102,12 @@ when using this command.
|
|
|
1101
1102
|
|
|
1102
1103
|
Compares the infrastructure specified in the current state of the CDK app with
|
|
1103
1104
|
the currently deployed application, to determine if any resource was moved
|
|
1104
|
-
(to a different stack or to a different logical ID, or both).
|
|
1105
|
-
|
|
1105
|
+
(to a different stack or to a different logical ID, or both). In keeping with
|
|
1106
|
+
the CloudFormation API, you are not allowed to modify the set of resources
|
|
1107
|
+
as part of a refactor. In other words, adding, deleting or updating resources
|
|
1108
|
+
is considered an error.
|
|
1109
|
+
|
|
1110
|
+
The CLI will show the correspondence between the old and new locations in a table:
|
|
1106
1111
|
|
|
1107
1112
|
```
|
|
1108
1113
|
$ cdk refactor --unstable=refactor --dry-run
|
|
@@ -1125,41 +1130,45 @@ show this table and exit. Eventually, the CLI will also be able to automatically
|
|
|
1125
1130
|
apply the refactor on your CloudFormation stacks. But for now, only the dry-run
|
|
1126
1131
|
mode is supported.
|
|
1127
1132
|
|
|
1128
|
-
If
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
example, if you don't want to include the bucket and the distribution from
|
|
1132
|
-
the table above in the refactor, you can create a file called
|
|
1133
|
-
`exclude.txt` with the following content (destination locations separated by
|
|
1134
|
-
newlines):
|
|
1133
|
+
If your application has more than one stack, and you want the `refactor`
|
|
1134
|
+
command to consider only a subset of them, you can pass a list of stack
|
|
1135
|
+
patterns as a parameter:
|
|
1135
1136
|
|
|
1137
|
+
```shell
|
|
1138
|
+
$ cdk refactor Web* --unstable=refactor --dry-run
|
|
1136
1139
|
```
|
|
1137
|
-
Web/Website/Origin/Resource
|
|
1138
|
-
Web/Website/Distribution/Resource
|
|
1139
|
-
```
|
|
1140
1140
|
|
|
1141
|
-
|
|
1141
|
+
The pattern language is the same as the one used in the `cdk deploy` command.
|
|
1142
|
+
However, unlike `cdk deploy`, in the absence of this parameter, all stacks are
|
|
1143
|
+
considered.
|
|
1144
|
+
|
|
1145
|
+
The CLI's default behavior is to include in the comparison only the deployed
|
|
1146
|
+
stacks that have a counterpart (stack with the same name) locally. If you want
|
|
1147
|
+
to include additional deployed stacks in the comparison, pass their names using
|
|
1148
|
+
the `--additional-stack-name` option:
|
|
1142
1149
|
|
|
1143
1150
|
```shell
|
|
1144
|
-
$ cdk refactor --
|
|
1151
|
+
$ cdk refactor --unstable=refactor --dry-run --additional-stack-name=Foo --additional-stack-name=Bar
|
|
1145
1152
|
```
|
|
1146
1153
|
|
|
1147
|
-
|
|
1148
|
-
command to consider only a subset of them, you can pass a list of stack
|
|
1149
|
-
patterns as a parameter:
|
|
1154
|
+
In case of ambiguities, the CLI will display a table like this:
|
|
1150
1155
|
|
|
1151
|
-
```
|
|
1152
|
-
|
|
1156
|
+
```
|
|
1157
|
+
Detected ambiguities:
|
|
1158
|
+
┌───┬──────────────────────┐
|
|
1159
|
+
│ │ Resource │
|
|
1160
|
+
├───┼──────────────────────┤
|
|
1161
|
+
│ - │ Stack2/DLQ/Resource │
|
|
1162
|
+
│ │ Stack2/DLQ2/Resource │
|
|
1163
|
+
├───┼──────────────────────┤
|
|
1164
|
+
│ + │ Stack1/DLQ/Resource │
|
|
1165
|
+
│ │ Stack1/DLQ2/Resource │
|
|
1166
|
+
└───┴──────────────────────┘
|
|
1153
1167
|
```
|
|
1154
1168
|
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
If, instead of letting the CLI decide which resources to move, you want to
|
|
1160
|
-
provide your own mapping of old to new locations, you can do so by passing a
|
|
1161
|
-
mapping file to the CLI via the `--mapping-file` flag. This file should
|
|
1162
|
-
contain a JSON object with the following format:
|
|
1169
|
+
You can resolve this ambiguity manually, by passing an override file via the
|
|
1170
|
+
`--override-file=<path>` CLI option. This file should contain a JSON object
|
|
1171
|
+
with the following structure:
|
|
1163
1172
|
|
|
1164
1173
|
```json
|
|
1165
1174
|
{
|
|
@@ -1168,22 +1177,19 @@ contain a JSON object with the following format:
|
|
|
1168
1177
|
"account": "123456789012",
|
|
1169
1178
|
"region": "us-east-1",
|
|
1170
1179
|
"resources": {
|
|
1171
|
-
"
|
|
1180
|
+
"Stack2.OldName": "Stack2.NewName"
|
|
1172
1181
|
}
|
|
1173
1182
|
}
|
|
1174
1183
|
]
|
|
1175
1184
|
}
|
|
1176
1185
|
```
|
|
1177
1186
|
|
|
1178
|
-
where `resources` is a mapping of resources from source to destination
|
|
1179
|
-
locations for a given environment. Resource locations are in the format
|
|
1180
|
-
`StackName.LogicalId`.The source must refer to a location where there is a
|
|
1181
|
-
resource currently deployed, while the destination must refer to a location
|
|
1187
|
+
where `resources` is a mapping of resources from source to destination
|
|
1188
|
+
locations for a given environment. Resource locations are in the format
|
|
1189
|
+
`StackName.LogicalId`.The source must refer to a location where there is a
|
|
1190
|
+
resource currently deployed, while the destination must refer to a location
|
|
1182
1191
|
that is not already occupied by any resource.
|
|
1183
1192
|
|
|
1184
|
-
If you want to undo a refactor, you can use the `--revert` option in
|
|
1185
|
-
conjunction with the `--mapping-file` option. It will apply the mapping in
|
|
1186
|
-
reverse order (source becomes destination and vice versa).
|
|
1187
1193
|
|
|
1188
1194
|
### `cdk drift`
|
|
1189
1195
|
|
|
@@ -1208,6 +1214,31 @@ $ # Detect drift against the currently-deployed stack with the verbose flag enab
|
|
|
1208
1214
|
$ cdk drift --verbose
|
|
1209
1215
|
```
|
|
1210
1216
|
|
|
1217
|
+
### `cdk cli-telemetry`
|
|
1218
|
+
|
|
1219
|
+
Enables or disables cli telemetry collection for your local CDK App. Records your
|
|
1220
|
+
choice in `cdk.context.json`. You can also set your preference manually under the `context` key in your
|
|
1221
|
+
`~/.cdk.json` file or `<app-root>/cdk.json` file.
|
|
1222
|
+
|
|
1223
|
+
```bash
|
|
1224
|
+
$ # Disable telemetry
|
|
1225
|
+
$ cdk cli-telemetry --disable
|
|
1226
|
+
|
|
1227
|
+
$ # Enable telemetry
|
|
1228
|
+
$ cdk cli-telemetry --enable
|
|
1229
|
+
```
|
|
1230
|
+
|
|
1231
|
+
You can also check the current status on whether your CDK App is opted in or out of
|
|
1232
|
+
cli telemetry collection. Note that this takes into account all methods of disabling
|
|
1233
|
+
cli telemetry, including environment variables and
|
|
1234
|
+
[context values](https://docs.aws.amazon.com/cdk/v2/guide/context.html)
|
|
1235
|
+
that can be set in many different ways (such as `~/.cdk.json`).
|
|
1236
|
+
|
|
1237
|
+
```bash
|
|
1238
|
+
$ # Check the current status of telemetry
|
|
1239
|
+
$ cdk cli-telemetry --status
|
|
1240
|
+
```
|
|
1241
|
+
|
|
1211
1242
|
## Global Options
|
|
1212
1243
|
|
|
1213
1244
|
### `unstable`
|
|
@@ -1223,6 +1254,20 @@ cdk gc --unstable=gc
|
|
|
1223
1254
|
The command will fail if `--unstable=gc` is not passed in, which acknowledges that the user
|
|
1224
1255
|
is aware of the caveats in place for the feature.
|
|
1225
1256
|
|
|
1257
|
+
### `telemetry-file`
|
|
1258
|
+
|
|
1259
|
+
Send your telemetry data to a local file (note that `--telemetry-file` is unstable, and must
|
|
1260
|
+
be passed in conjunction with `--unstable=telemetry`).
|
|
1261
|
+
|
|
1262
|
+
```bash
|
|
1263
|
+
cdk list --telemetry-file=my/file/path --unstable=telemetry
|
|
1264
|
+
```
|
|
1265
|
+
|
|
1266
|
+
The supplied path must be a non existing file. If the file exists, it will fail to log telemetry
|
|
1267
|
+
data but the command itself will continue uninterrupted.
|
|
1268
|
+
|
|
1269
|
+
> Note: The file will be written to regardless of your opt-out status.
|
|
1270
|
+
|
|
1226
1271
|
## Notices
|
|
1227
1272
|
|
|
1228
1273
|
CDK Notices are important messages regarding security vulnerabilities, regressions, and usage of unsupported
|