aws-cdk 2.1013.0 → 2.1015.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 +128 -20
- package/THIRD_PARTY_LICENSES +67 -67
- package/build-info.json +2 -2
- package/db.json.gz +0 -0
- package/lib/api/aws-auth.d.ts +1 -0
- package/lib/api/aws-auth.js +3 -1
- package/lib/api/bootstrap/bootstrap-template.yaml +12 -1
- package/lib/api/bootstrap.js +2 -1
- package/lib/api/cloud-assembly.js +2 -1
- package/lib/api/cloudformation.js +2 -1
- package/lib/api/context.js +2 -1
- package/lib/api/deployments.js +2 -1
- package/lib/api/hotswap.js +2 -1
- package/lib/api/index.d.ts +12 -6
- package/lib/api/index.js +18 -7
- package/lib/api/notices.js +2 -1
- package/lib/api/plugin.js +2 -1
- package/lib/api/settings.js +2 -1
- package/lib/api/tags.js +2 -1
- package/lib/api-private.d.ts +3 -1
- package/lib/api-private.js +5 -2
- package/lib/cli/cdk-toolkit.d.ts +47 -2
- package/lib/cli/cdk-toolkit.js +102 -88
- package/lib/cli/cli-config.js +43 -4
- package/lib/cli/cli.js +45 -45
- package/lib/cli/convert-to-user-input.js +19 -1
- package/lib/cli/io-host/cli-io-host.d.ts +3 -3
- package/lib/cli/io-host/cli-io-host.js +13 -14
- package/lib/cli/messages.d.ts +1 -1
- package/lib/cli/messages.js +1 -1
- package/lib/cli/parse-command-line-arguments.js +51 -3
- package/lib/cli/pretty-print-error.js +2 -2
- package/lib/cli/root-dir.js +3 -3
- package/lib/cli/singleton-plugin-host.d.ts +1 -1
- package/lib/cli/singleton-plugin-host.js +3 -3
- package/lib/cli/user-configuration.js +12 -11
- package/lib/cli/user-input.d.ts +54 -0
- package/lib/cli/user-input.js +1 -1
- package/lib/cli/util/npm.js +4 -4
- package/lib/cli/util/yargs-helpers.d.ts +10 -0
- package/lib/cli/util/yargs-helpers.js +18 -3
- package/lib/cli/version.js +3 -3
- package/lib/commands/context.js +7 -7
- package/lib/commands/init/init-hooks.js +3 -3
- package/lib/commands/init/init.js +8 -8
- package/lib/commands/init/os.js +3 -3
- package/lib/commands/list-stacks.d.ts +1 -1
- package/lib/commands/list-stacks.js +1 -1
- package/lib/commands/migrate.js +18 -17
- package/lib/context-providers.d.ts +1 -0
- package/lib/{api/logs-monitor.js → context-providers.js} +3 -2
- package/lib/cxapp/cloud-assembly.d.ts +1 -1
- package/lib/cxapp/cloud-assembly.js +13 -12
- package/lib/cxapp/cloud-executable.d.ts +2 -2
- package/lib/cxapp/cloud-executable.js +7 -8
- package/lib/cxapp/environments.js +5 -5
- package/lib/cxapp/exec.d.ts +1 -1
- package/lib/cxapp/exec.js +12 -11
- package/lib/index.js +220668 -218476
- package/lib/init-templates/.init-version.json +1 -1
- package/lib/init-templates/.recommended-feature-flags.json +2 -1
- package/lib/init-templates/app/typescript/tsconfig.json +4 -3
- package/lib/init-templates/lib/typescript/tsconfig.json +5 -4
- package/lib/init-templates/sample-app/typescript/tsconfig.json +4 -3
- package/lib/legacy-aws-auth.js +1 -1
- package/lib/legacy-exports-source.d.ts +1 -1
- package/lib/legacy-exports-source.js +3 -3
- package/lib/legacy-types.js +1 -1
- package/lib/logging.js +4 -4
- package/lib/util.js +2 -1
- package/package.json +21 -22
- package/lib/api/environment.d.ts +0 -1
- package/lib/api/environment.js +0 -18
- package/lib/api/garbage-collection.d.ts +0 -1
- package/lib/api/garbage-collection.js +0 -18
- package/lib/api/logs-monitor.d.ts +0 -1
- package/lib/api/resource-import.d.ts +0 -1
- package/lib/api/resource-import.js +0 -18
- package/lib/api/rwlock.d.ts +0 -1
- package/lib/api/rwlock.js +0 -18
- package/lib/api/stack-events.d.ts +0 -1
- package/lib/api/stack-events.js +0 -18
- package/lib/api/toolkit-info.d.ts +0 -1
- package/lib/api/toolkit-info.js +0 -18
- package/lib/api/tree.d.ts +0 -1
- package/lib/api/tree.js +0 -18
- package/lib/api/work-graph.d.ts +0 -1
- package/lib/api/work-graph.js +0 -18
- package/lib/commands/diff.d.ts +0 -1
- package/lib/commands/diff.js +0 -7
- package/lib/context-providers/ami.d.ts +0 -1
- package/lib/context-providers/ami.js +0 -18
- package/lib/context-providers/availability-zones.d.ts +0 -1
- package/lib/context-providers/availability-zones.js +0 -18
- package/lib/context-providers/cc-api-provider.d.ts +0 -1
- package/lib/context-providers/cc-api-provider.js +0 -18
- package/lib/context-providers/endpoint-service-availability-zones.d.ts +0 -1
- package/lib/context-providers/endpoint-service-availability-zones.js +0 -18
- package/lib/context-providers/hosted-zones.d.ts +0 -1
- package/lib/context-providers/hosted-zones.js +0 -18
- package/lib/context-providers/index.d.ts +0 -1
- package/lib/context-providers/index.js +0 -18
- package/lib/context-providers/keys.d.ts +0 -1
- package/lib/context-providers/keys.js +0 -18
- package/lib/context-providers/load-balancers.d.ts +0 -1
- package/lib/context-providers/load-balancers.js +0 -18
- package/lib/context-providers/security-groups.d.ts +0 -1
- package/lib/context-providers/security-groups.js +0 -18
- package/lib/context-providers/ssm-parameters.d.ts +0 -1
- package/lib/context-providers/ssm-parameters.js +0 -18
- package/lib/context-providers/vpcs.d.ts +0 -1
- package/lib/context-providers/vpcs.js +0 -18
package/README.md
CHANGED
|
@@ -11,24 +11,25 @@
|
|
|
11
11
|
|
|
12
12
|
The AWS CDK Toolkit provides the `cdk` command-line interface that can be used to work with AWS CDK applications.
|
|
13
13
|
|
|
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-synthesize) | 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
|
|
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-synthesize) | 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 |
|
|
32
33
|
|
|
33
34
|
- [Bundling](#bundling)
|
|
34
35
|
- [MFA Support](#mfa-support)
|
|
@@ -504,19 +505,34 @@ Hotswapping is currently supported for the following changes
|
|
|
504
505
|
- VTL mapping template changes for AppSync Resolvers and Functions.
|
|
505
506
|
- Schema changes for AppSync GraphQL Apis.
|
|
506
507
|
|
|
507
|
-
You can optionally configure the behavior of your hotswap deployments
|
|
508
|
+
You can optionally configure the behavior of your hotswap deployments. Currently you can only configure ECS hotswap behavior:
|
|
509
|
+
|
|
510
|
+
| Property | Description | Default |
|
|
511
|
+
|--------------------------------|--------------------------------------|-------------|
|
|
512
|
+
| minimumHealthyPercent | Lower limit on the number of your service's tasks that must remain in the RUNNING state during a deployment, as a percentage of the desiredCount | **REPLICA:** 100, **DAEMON:** 0 |
|
|
513
|
+
| maximumHealthyPercent | Upper limit on the number of your service's tasks that are allowed in the RUNNING or PENDING state during a deployment, as a percentage of the desiredCount | **REPLICA:** 200, **DAEMON:**: N/A |
|
|
514
|
+
| stabilizationTimeoutSeconds | Number of seconds to wait for a single service to reach stable state, where the desiredCount is equal to the runningCount | 600 |
|
|
515
|
+
|
|
516
|
+
##### cdk.json
|
|
508
517
|
|
|
509
518
|
```json
|
|
510
519
|
{
|
|
511
520
|
"hotswap": {
|
|
512
521
|
"ecs": {
|
|
513
522
|
"minimumHealthyPercent": 100,
|
|
514
|
-
"maximumHealthyPercent": 250
|
|
523
|
+
"maximumHealthyPercent": 250,
|
|
524
|
+
"stabilizationTimeoutSeconds": 300,
|
|
515
525
|
}
|
|
516
526
|
}
|
|
517
527
|
}
|
|
518
528
|
```
|
|
519
529
|
|
|
530
|
+
##### cli arguments
|
|
531
|
+
|
|
532
|
+
```console
|
|
533
|
+
cdk deploy --hotswap --hotswap-ecs-minimum-healthy-percent 100 --hotswap-ecs-maximum-healthy-percent 250 --hotswap-ecs-stabilization-timeout-seconds 300
|
|
534
|
+
```
|
|
535
|
+
|
|
520
536
|
**⚠ Note #1**: This command deliberately introduces drift in CloudFormation stacks in order to speed up deployments.
|
|
521
537
|
For this reason, only use it for development purposes.
|
|
522
538
|
**Never use this flag for your production deployments**!
|
|
@@ -1066,6 +1082,98 @@ $ cdk doctor
|
|
|
1066
1082
|
- AWS_SDK_LOAD_CONFIG = 1
|
|
1067
1083
|
```
|
|
1068
1084
|
|
|
1085
|
+
### `cdk refactor`
|
|
1086
|
+
|
|
1087
|
+
⚠️**CAUTION**⚠️: CDK Refactor is currently experimental and may have
|
|
1088
|
+
breaking changes in the future. Make sure to use the `--unstable=refactor` flag
|
|
1089
|
+
when using this command.
|
|
1090
|
+
|
|
1091
|
+
Compares the infrastructure specified in the current state of the CDK app with
|
|
1092
|
+
the currently deployed application, to determine if any resource was moved
|
|
1093
|
+
(to a different stack or to a different logical ID, or both). The CLI will
|
|
1094
|
+
show the correspondence between the old and new locations in a table:
|
|
1095
|
+
|
|
1096
|
+
```
|
|
1097
|
+
$ cdk refactor --unstable=refactor --dry-run
|
|
1098
|
+
|
|
1099
|
+
The following resources were moved or renamed:
|
|
1100
|
+
|
|
1101
|
+
┌───────────────────────────────┬───────────────────────────────┬───────────────────────────────────┐
|
|
1102
|
+
│ Resource Type │ Old Construct Path │ New Construct Path │
|
|
1103
|
+
├───────────────────────────────┼───────────────────────────────┼───────────────────────────────────┤
|
|
1104
|
+
│ AWS::S3::Bucket │ MyStack/Bucket/Resource │ Web/Website/Origin/Resource │
|
|
1105
|
+
├───────────────────────────────┼───────────────────────────────┼───────────────────────────────────┤
|
|
1106
|
+
│ AWS::CloudFront::Distribution │ MyStack/Distribution/Resource │ Web/Website/Distribution/Resource │
|
|
1107
|
+
├───────────────────────────────┼───────────────────────────────┼───────────────────────────────────┤
|
|
1108
|
+
│ AWS::Lambda::Function │ MyStack/Function/Resource │ Service/Function/Resource │
|
|
1109
|
+
└───────────────────────────────┴───────────────────────────────┴───────────────────────────────────┘
|
|
1110
|
+
```
|
|
1111
|
+
|
|
1112
|
+
Note the use of the `--dry-run` flag. When this flag is used, the CLI will
|
|
1113
|
+
show this table and exit. Eventually, the CLI will also be able to automatically
|
|
1114
|
+
apply the refactor on your CloudFormation stacks. But for now, only the dry-run
|
|
1115
|
+
mode is supported.
|
|
1116
|
+
|
|
1117
|
+
If you want to exclude some resources from the refactor, you can pass an
|
|
1118
|
+
exclude file, containing a list of destination locations to exclude. A
|
|
1119
|
+
location can be either the stack name + logical ID, or the construct path. For
|
|
1120
|
+
example, if you don't want to include the bucket and the distribution from
|
|
1121
|
+
the table above in the refactor, you can create a file called
|
|
1122
|
+
`exclude.txt` with the following content (destination locations separated by
|
|
1123
|
+
newlines):
|
|
1124
|
+
|
|
1125
|
+
```
|
|
1126
|
+
Web/Website/Origin/Resource
|
|
1127
|
+
Web/Website/Distribution/Resource
|
|
1128
|
+
```
|
|
1129
|
+
|
|
1130
|
+
and pass it to the CLI via the `--exclude-file` flag:
|
|
1131
|
+
|
|
1132
|
+
```shell
|
|
1133
|
+
$ cdk refactor --exclude-file exclude.txt --unstable=refactor --dry-run
|
|
1134
|
+
```
|
|
1135
|
+
|
|
1136
|
+
If your application has more than one stack, and you want the refactor
|
|
1137
|
+
command to consider only a subset of them, you can pass a list of stack
|
|
1138
|
+
patterns as a parameter:
|
|
1139
|
+
|
|
1140
|
+
```shell
|
|
1141
|
+
$ cdk refactor Web* --unstable=refactor --dry-run
|
|
1142
|
+
```
|
|
1143
|
+
|
|
1144
|
+
The pattern language is the same as the one used in the `cdk deploy` command.
|
|
1145
|
+
However, unlike `cdk deploy`, in the absence of this parameter, all stacks are
|
|
1146
|
+
considered.
|
|
1147
|
+
|
|
1148
|
+
If, instead of letting the CLI decide which resources to move, you want to
|
|
1149
|
+
provide your own mapping of old to new locations, you can do so by passing a
|
|
1150
|
+
mapping file to the CLI via the `--mapping-file` flag. This file should
|
|
1151
|
+
contain a JSON object with the following format:
|
|
1152
|
+
|
|
1153
|
+
```json
|
|
1154
|
+
{
|
|
1155
|
+
"mappings": [
|
|
1156
|
+
{
|
|
1157
|
+
"account": "123456789012",
|
|
1158
|
+
"region": "us-east-1",
|
|
1159
|
+
"resources": {
|
|
1160
|
+
"Foo.OldName": "Bar.NewName"
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
]
|
|
1164
|
+
}
|
|
1165
|
+
```
|
|
1166
|
+
|
|
1167
|
+
where `resources` is a mapping of resources from source to destination
|
|
1168
|
+
locations for a given environment. Resource locations are in the format
|
|
1169
|
+
`StackName.LogicalId`.The source must refer to a location where there is a
|
|
1170
|
+
resource currently deployed, while the destination must refer to a location
|
|
1171
|
+
that is not already occupied by any resource.
|
|
1172
|
+
|
|
1173
|
+
If you want to undo a refactor, you can use the `--revert` option in
|
|
1174
|
+
conjunction with the `--mapping-file` option. It will apply the mapping in
|
|
1175
|
+
reverse order (source becomes destination and vice versa).
|
|
1176
|
+
|
|
1069
1177
|
## Notices
|
|
1070
1178
|
|
|
1071
1179
|
CDK Notices are important messages regarding security vulnerabilities, regressions, and usage of unsupported
|