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.
Files changed (112) hide show
  1. package/README.md +128 -20
  2. package/THIRD_PARTY_LICENSES +67 -67
  3. package/build-info.json +2 -2
  4. package/db.json.gz +0 -0
  5. package/lib/api/aws-auth.d.ts +1 -0
  6. package/lib/api/aws-auth.js +3 -1
  7. package/lib/api/bootstrap/bootstrap-template.yaml +12 -1
  8. package/lib/api/bootstrap.js +2 -1
  9. package/lib/api/cloud-assembly.js +2 -1
  10. package/lib/api/cloudformation.js +2 -1
  11. package/lib/api/context.js +2 -1
  12. package/lib/api/deployments.js +2 -1
  13. package/lib/api/hotswap.js +2 -1
  14. package/lib/api/index.d.ts +12 -6
  15. package/lib/api/index.js +18 -7
  16. package/lib/api/notices.js +2 -1
  17. package/lib/api/plugin.js +2 -1
  18. package/lib/api/settings.js +2 -1
  19. package/lib/api/tags.js +2 -1
  20. package/lib/api-private.d.ts +3 -1
  21. package/lib/api-private.js +5 -2
  22. package/lib/cli/cdk-toolkit.d.ts +47 -2
  23. package/lib/cli/cdk-toolkit.js +102 -88
  24. package/lib/cli/cli-config.js +43 -4
  25. package/lib/cli/cli.js +45 -45
  26. package/lib/cli/convert-to-user-input.js +19 -1
  27. package/lib/cli/io-host/cli-io-host.d.ts +3 -3
  28. package/lib/cli/io-host/cli-io-host.js +13 -14
  29. package/lib/cli/messages.d.ts +1 -1
  30. package/lib/cli/messages.js +1 -1
  31. package/lib/cli/parse-command-line-arguments.js +51 -3
  32. package/lib/cli/pretty-print-error.js +2 -2
  33. package/lib/cli/root-dir.js +3 -3
  34. package/lib/cli/singleton-plugin-host.d.ts +1 -1
  35. package/lib/cli/singleton-plugin-host.js +3 -3
  36. package/lib/cli/user-configuration.js +12 -11
  37. package/lib/cli/user-input.d.ts +54 -0
  38. package/lib/cli/user-input.js +1 -1
  39. package/lib/cli/util/npm.js +4 -4
  40. package/lib/cli/util/yargs-helpers.d.ts +10 -0
  41. package/lib/cli/util/yargs-helpers.js +18 -3
  42. package/lib/cli/version.js +3 -3
  43. package/lib/commands/context.js +7 -7
  44. package/lib/commands/init/init-hooks.js +3 -3
  45. package/lib/commands/init/init.js +8 -8
  46. package/lib/commands/init/os.js +3 -3
  47. package/lib/commands/list-stacks.d.ts +1 -1
  48. package/lib/commands/list-stacks.js +1 -1
  49. package/lib/commands/migrate.js +18 -17
  50. package/lib/context-providers.d.ts +1 -0
  51. package/lib/{api/logs-monitor.js → context-providers.js} +3 -2
  52. package/lib/cxapp/cloud-assembly.d.ts +1 -1
  53. package/lib/cxapp/cloud-assembly.js +13 -12
  54. package/lib/cxapp/cloud-executable.d.ts +2 -2
  55. package/lib/cxapp/cloud-executable.js +7 -8
  56. package/lib/cxapp/environments.js +5 -5
  57. package/lib/cxapp/exec.d.ts +1 -1
  58. package/lib/cxapp/exec.js +12 -11
  59. package/lib/index.js +220668 -218476
  60. package/lib/init-templates/.init-version.json +1 -1
  61. package/lib/init-templates/.recommended-feature-flags.json +2 -1
  62. package/lib/init-templates/app/typescript/tsconfig.json +4 -3
  63. package/lib/init-templates/lib/typescript/tsconfig.json +5 -4
  64. package/lib/init-templates/sample-app/typescript/tsconfig.json +4 -3
  65. package/lib/legacy-aws-auth.js +1 -1
  66. package/lib/legacy-exports-source.d.ts +1 -1
  67. package/lib/legacy-exports-source.js +3 -3
  68. package/lib/legacy-types.js +1 -1
  69. package/lib/logging.js +4 -4
  70. package/lib/util.js +2 -1
  71. package/package.json +21 -22
  72. package/lib/api/environment.d.ts +0 -1
  73. package/lib/api/environment.js +0 -18
  74. package/lib/api/garbage-collection.d.ts +0 -1
  75. package/lib/api/garbage-collection.js +0 -18
  76. package/lib/api/logs-monitor.d.ts +0 -1
  77. package/lib/api/resource-import.d.ts +0 -1
  78. package/lib/api/resource-import.js +0 -18
  79. package/lib/api/rwlock.d.ts +0 -1
  80. package/lib/api/rwlock.js +0 -18
  81. package/lib/api/stack-events.d.ts +0 -1
  82. package/lib/api/stack-events.js +0 -18
  83. package/lib/api/toolkit-info.d.ts +0 -1
  84. package/lib/api/toolkit-info.js +0 -18
  85. package/lib/api/tree.d.ts +0 -1
  86. package/lib/api/tree.js +0 -18
  87. package/lib/api/work-graph.d.ts +0 -1
  88. package/lib/api/work-graph.js +0 -18
  89. package/lib/commands/diff.d.ts +0 -1
  90. package/lib/commands/diff.js +0 -7
  91. package/lib/context-providers/ami.d.ts +0 -1
  92. package/lib/context-providers/ami.js +0 -18
  93. package/lib/context-providers/availability-zones.d.ts +0 -1
  94. package/lib/context-providers/availability-zones.js +0 -18
  95. package/lib/context-providers/cc-api-provider.d.ts +0 -1
  96. package/lib/context-providers/cc-api-provider.js +0 -18
  97. package/lib/context-providers/endpoint-service-availability-zones.d.ts +0 -1
  98. package/lib/context-providers/endpoint-service-availability-zones.js +0 -18
  99. package/lib/context-providers/hosted-zones.d.ts +0 -1
  100. package/lib/context-providers/hosted-zones.js +0 -18
  101. package/lib/context-providers/index.d.ts +0 -1
  102. package/lib/context-providers/index.js +0 -18
  103. package/lib/context-providers/keys.d.ts +0 -1
  104. package/lib/context-providers/keys.js +0 -18
  105. package/lib/context-providers/load-balancers.d.ts +0 -1
  106. package/lib/context-providers/load-balancers.js +0 -18
  107. package/lib/context-providers/security-groups.d.ts +0 -1
  108. package/lib/context-providers/security-groups.js +0 -18
  109. package/lib/context-providers/ssm-parameters.d.ts +0 -1
  110. package/lib/context-providers/ssm-parameters.js +0 -18
  111. package/lib/context-providers/vpcs.d.ts +0 -1
  112. 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 in `cdk.json`. Currently you can only configure ECS hotswap behavior:
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