@btc-embedded/cdk-extensions 0.22.13 → 0.22.15

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 (52) hide show
  1. package/.jsii +3 -3
  2. package/CHANGELOG.md +15 -0
  3. package/README.md +34 -60
  4. package/assets/cli/catnip.js +114 -154
  5. package/lib/constructs/EventPipe.js +1 -1
  6. package/lib/constructs/ExportedService.js +1 -1
  7. package/lib/constructs/S3Bucket.js +1 -1
  8. package/lib/constructs/SecureRestApi.js +1 -1
  9. package/lib/constructs/SecureRestApiV2.js +1 -1
  10. package/lib/constructs/api-keys/ApiKeyClientAuthorization.js +1 -1
  11. package/lib/constructs/api-keys/ApiKeyManagement.js +1 -1
  12. package/lib/constructs/api-keys/ApiKeyPreTokenHandler.js +1 -1
  13. package/lib/constructs/api-keys/ApiKeyStore.js +1 -1
  14. package/lib/extensions/ApiGatewayExtension.js +1 -1
  15. package/lib/extensions/ApplicationContainer.js +1 -1
  16. package/lib/extensions/ApplicationLoadBalancerExtension.js +1 -1
  17. package/lib/extensions/ApplicationLoadBalancerExtensionV2.js +1 -1
  18. package/lib/extensions/CloudMapExtension.js +1 -1
  19. package/lib/extensions/DeactivatableServiceExtension.js +1 -1
  20. package/lib/extensions/DeploymentConfigExtension.js +1 -1
  21. package/lib/extensions/DocumentDbAccessExtension.js +1 -1
  22. package/lib/extensions/DomainEventMessagingExtension.js +1 -1
  23. package/lib/extensions/EfsMountExtension.js +1 -1
  24. package/lib/extensions/ExtraContainerExtension.js +1 -1
  25. package/lib/extensions/HTTPApiExtension.js +1 -1
  26. package/lib/extensions/LogExtension.js +1 -1
  27. package/lib/extensions/ModifyContainerDefinitionExtension.js +1 -1
  28. package/lib/extensions/ModifyTaskDefinitionExtension.js +1 -1
  29. package/lib/extensions/OpenIdExtension.js +1 -1
  30. package/lib/extensions/OpenTelemetryExtension.js +1 -1
  31. package/lib/extensions/PostgresDbAccessExtension.js +1 -1
  32. package/lib/extensions/SharedVolumeExtension.js +1 -1
  33. package/lib/extensions/TcpKeepAliveExtension.js +1 -1
  34. package/lib/platform/ApiGateway.js +1 -1
  35. package/lib/platform/ApiGatewayVpcLink.js +2 -2
  36. package/lib/platform/ApplicationLoadBalancer.js +1 -1
  37. package/lib/platform/ApplicationLoadBalancerV2.js +2 -2
  38. package/lib/platform/BTCLogGroup.js +1 -1
  39. package/lib/platform/CognitoUserPool.js +2 -2
  40. package/lib/platform/DefaultUserPoolClients.js +1 -1
  41. package/lib/platform/DocumentDB.js +2 -2
  42. package/lib/platform/EcsCluster.js +1 -1
  43. package/lib/platform/EfsFileSystem.js +1 -1
  44. package/lib/platform/HostedZone.js +1 -1
  45. package/lib/platform/PrivateDnsNamespace.js +1 -1
  46. package/lib/platform/ResourceServer.js +1 -1
  47. package/lib/platform/Vpc.js +1 -1
  48. package/lib/platform/VpcV2.js +1 -1
  49. package/lib/stacks/ApplicationStack.js +1 -1
  50. package/lib/utils/BasePlatformStackResolver.js +1 -1
  51. package/lib/utils/StackParameter.js +1 -1
  52. package/package.json +1 -1
package/.jsii CHANGED
@@ -8497,7 +8497,7 @@
8497
8497
  },
8498
8498
  "name": "@btc-embedded/cdk-extensions",
8499
8499
  "readme": {
8500
- "markdown": "# BTC Embedded CDK Extensions\n\n# @btc-embedded/cdk-extensions\n\nA collection of reusable AWS CDK (Cloud Development Kit) extensions and constructs for building cloud infrastructure with TypeScript.\n\n## Features\n\n- **CDK Constructs**: Includes ready-to-use constructs for API Gateway, Application Load Balancer, Cognito, VPC, DocumentDB, and more.\n- **ECS Service Extensions**: Provides ECS service extensions for advanced container orchestration.\n- **Utilities**: Common utilities and helpers for stack parameters, value imports, and configuration parsing.\n- **Modular Extensions**: Easily extend AWS resources with features like logging, OpenTelemetry, EFS, Cloud Map, and custom containers.\n\n## Installation\n\n```sh\nyarn install @btc-embedded/cdk-extensions\n```\n\n## Usage Example\n\n### Basic Usage\n\n```typescript\nimport { ApiGateway } from \"@btc-embedded/cdk-extensions\";\n\n// Use constructs and extensions in your CDK app\n```\n\n### Using ApplicationStack for Simplified Configuration\n\nFor application-level stacks that reference a base platform stack, use `ApplicationStack` to ensure consistent use of the base platform stack name:\n\n```typescript\nimport { ApplicationStack } from \"@btc-embedded/cdk-extensions\";\n\nexport class MyAppStack extends ApplicationStack {\n constructor(scope: Construct, id: string) {\n super(scope, id, {\n basePlatformStackName: \"my-platform-stack\",\n env: {\n account: \"123456789012\",\n region: \"eu-central-1\",\n },\n });\n\n // Constructs and extensions automatically resolve the platform stack name\n // No need to pass basePlatformStackName repeatedly\n }\n}\n```\n\n### Config-Driven Deployments\n\nUse `createApplicationApp` for configuration-driven deployments:\n\n```typescript\nimport {\n createApplicationApp,\n ApplicationStack,\n} from \"@btc-embedded/cdk-extensions\";\nimport { z } from \"zod\";\n\nconst configSchema = z.object({\n env: z.object({ account: z.string(), region: z.string() }),\n basePlatformStackName: z.string(),\n});\n\ncreateApplicationApp({\n directory: \"./config\",\n schema: configSchema,\n createStack: (scope, config) => new MyAppStack(scope, \"MyApp\", config),\n});\n```\n\n## CLI Commands\n\n### catnip — Cloud Toolkit by the CAT Department\n\nThe `catnip` CLI tool provides commands for cloud infrastructure diagnostics and management.\n\n#### stack-diagnose\n\nDiagnose CloudFormation stack deployment failures.\n\n**Usage:**\n\n```bash\n# Auto-detect and diagnose the last failed stack\ncatnip stack-diagnose\n\n# Diagnose a specific stack\ncatnip stack-diagnose --stack-name my-stack\n\n# Customize log output and task inspection\ncatnip stack-diagnose --stack-name my-stack --tail 200 --tasks 10\n```\n\n**Description:**\n\nThe `stack-diagnose` command provides comprehensive diagnostics for failed CloudFormation stacks. If no stack name is provided, it automatically detects and diagnoses the last failed stack in your AWS account. The command displays:\n\n- **Stack Status**: Current CloudFormation stack status and reason for failure\n- **CloudFormation Events**: Recent stack events showing what failed during deployment\n- **ECS Diagnostics** (if applicable): If the stack contains ECS services, additional diagnostics are performed including:\n - Service event history\n - Recent stopped task logs\n - Container output for troubleshooting\n\n**Options:**\n\n- `--stack-name <name>` — CloudFormation stack name (optional; auto-detects last failed stack if omitted)\n- `--stage <name>` — Filter stacks by stage name (e.g., 'prod', 'dev') when auto-detecting; only used if --stack-name is not provided\n- `--tail <n>` — Number of log lines to show per container (default: 100)\n- `--tasks <n>` — Number of recent stopped tasks to inspect (default: 5)\n- `--region <region>` — AWS region (uses AWS_DEFAULT_REGION / AWS_REGION environment variable if not specified)\n- `--profile <profile>` — AWS named profile for local development\n\n**Examples:**\n\n```bash\n# Quick diagnosis of last failed stack\ncatnip stack-diagnose\n\n# Auto-detect failed stack for a specific stage (useful when multiple stages in same account)\ncatnip stack-diagnose --stage prod\n\n# Diagnose specific stack with extended logging\ncatnip stack-diagnose --stack-name prod-api-stack --tail 500 --tasks 10\n\n# Use specific AWS profile and region\ncatnip stack-diagnose --profile my-profile --region eu-central-1\n```\n\n#### ecs-logs\n\nStream live logs from running ECS services in a CloudFormation stack.\n\n**Usage:**\n\n```bash\n# Stream logs from all ECS services in a stack\nnpx catnip ecs-logs --stack-name my-stack\n\n# Follow logs in real-time\nnpx catnip ecs-logs --stack-name my-stack --follow\n\n# Filter by service name and show last 50 lines\nnpx catnip ecs-logs --stack-name my-stack --tail 50 --service api\n\n# Raw JSON output (for piping to jq or pino-pretty)\nnpx catnip ecs-logs --stack-name my-stack --output raw\n\n# Pretty-printed JSON with colors\nnpx catnip ecs-logs --stack-name my-stack --output pretty\n```\n\n**Options:**\n\n- `--stack-name <name>` — CloudFormation stack name (required)\n- `--tail <n>` — Lines of history to show per container (default: 100)\n- `-f, --follow` — Keep polling for new log events\n- `--service <name>` — Filter services by name\n- `-o, --output <mode>` — Output mode: `text`, `raw`, or `pretty` (default: text)\n- `--region <region>` — AWS region\n- `--profile <profile>` — AWS profile\n\n## Documentation\n\n- [API Reference](./API.md)\n\n## License\n\nApache-2.0 © BTC Embedded Systems AG\n"
8500
+ "markdown": "# BTC Embedded CDK Extensions\n\n# @btc-embedded/cdk-extensions\n\nA collection of reusable AWS CDK (Cloud Development Kit) extensions and constructs for building cloud infrastructure with TypeScript.\n\n## Features\n\n- **CDK Constructs**: Includes ready-to-use constructs for API Gateway, Application Load Balancer, Cognito, VPC, DocumentDB, and more.\n- **ECS Service Extensions**: Provides ECS service extensions for advanced container orchestration.\n- **Utilities**: Common utilities and helpers for stack parameters, value imports, and configuration parsing.\n- **Modular Extensions**: Easily extend AWS resources with features like logging, OpenTelemetry, EFS, Cloud Map, and custom containers.\n\n## Installation\n\n```sh\nyarn install @btc-embedded/cdk-extensions\n```\n\n## Usage Example\n\n### Basic Usage\n\n```typescript\nimport { ApiGateway } from \"@btc-embedded/cdk-extensions\";\n\n// Use constructs and extensions in your CDK app\n```\n\n### Using ApplicationStack for Simplified Configuration\n\nFor application-level stacks that reference a base platform stack, use `ApplicationStack` to ensure consistent use of the base platform stack name:\n\n```typescript\nimport { ApplicationStack } from \"@btc-embedded/cdk-extensions\";\n\nexport class MyAppStack extends ApplicationStack {\n constructor(scope: Construct, id: string) {\n super(scope, id, {\n basePlatformStackName: \"my-platform-stack\",\n env: {\n account: \"123456789012\",\n region: \"eu-central-1\",\n },\n });\n\n // Constructs and extensions automatically resolve the platform stack name\n // No need to pass basePlatformStackName repeatedly\n }\n}\n```\n\n### Config-Driven Deployments\n\nUse `createApplicationApp` for configuration-driven deployments:\n\n```typescript\nimport {\n createApplicationApp,\n ApplicationStack,\n} from \"@btc-embedded/cdk-extensions\";\nimport { z } from \"zod\";\n\nconst configSchema = z.object({\n env: z.object({ account: z.string(), region: z.string() }),\n basePlatformStackName: z.string(),\n});\n\ncreateApplicationApp({\n directory: \"./config\",\n schema: configSchema,\n createStack: (scope, config) => new MyAppStack(scope, \"MyApp\", config),\n});\n```\n\n## CLI Commands\n\n### catnip — Cloud Toolkit by the CAT Department\n\n`catnip` provides operational helpers for CloudFormation, ECS, and Cognito.\n\nGlobal options (apply to all commands):\n- `--region <region>` — AWS region (defaults to `AWS_DEFAULT_REGION` / `AWS_REGION`)\n- `--profile <profile>` — AWS named profile\n\n#### stack-diagnose\n\nDiagnose failed CloudFormation deployments and show ECS failure context.\n\nUsage:\n\n```bash\ncatnip stack-diagnose\ncatnip stack-diagnose --stack-name my-stack\ncatnip stack-diagnose --stage prod\ncatnip stack-diagnose --stack-name my-stack --tail 200 --tasks 10\n```\n\nOptions:\n- `--stack-name <name>` — stack to diagnose (optional; auto-detects last failed stack if omitted)\n- `--stage <name>` — stage filter for auto-detection (ignored if `--stack-name` is provided)\n- `--tail <n>` — Number of log lines to show per container (default: 100)\n- `--tasks <n>` — Number of recent stopped tasks to inspect (default: 5)\n\n#### ecs-logs\n\nStream live logs from running ECS services in a CloudFormation stack.\n\nUsage:\n\n```bash\ncatnip ecs-logs --stack-name my-stack\ncatnip ecs-logs --stack-name my-stack --follow\ncatnip ecs-logs --stack-name my-stack --service api --tail 50\ncatnip ecs-logs --stack-name my-stack --output raw\ncatnip ecs-logs --stack-name my-stack --output pretty\n```\n\nOptions:\n- `--stack-name <name>` — CloudFormation stack name (required)\n- `--tail <n>` — Lines of history to show per container (default: 100)\n- `-f, --follow` — Keep polling for new log events\n- `--service <name>` — Filter services by name\n- `-o, --output <mode>` — Output mode: `text`, `raw`, or `pretty` (default: text)\n\n#### oidc-token\n\nFetch a Cognito token using CloudFormation exports from a stack.\n\nUsage:\n\n```bash\ncatnip oidc-token --stack-name my-stack\ncatnip oidc-token --stack-name my-stack --output json\n```\n\nOptions:\n- `--stack-name <name>` — stack that exported Cognito resources (required)\n- `--output <token|json>` — print token only, or full response JSON (default: `token`)\n - `token` output is the `access_token`\n\n## Documentation\n\n- [API Reference](./API.md)\n\n## License\n\nApache-2.0 © BTC Embedded Systems AG\n"
8501
8501
  },
8502
8502
  "repository": {
8503
8503
  "type": "git",
@@ -19883,6 +19883,6 @@
19883
19883
  "symbolId": "src/platform/VpcV2:VpcV2Props"
19884
19884
  }
19885
19885
  },
19886
- "version": "0.22.13",
19887
- "fingerprint": "NHAl+hv8nf71smgHZWF8KbmfH9dnLWlwUKV7Kw42jSE="
19886
+ "version": "0.22.15",
19887
+ "fingerprint": "axwLf8KDZSEYVbCwcQlEDJQHzf288NA3QXr3+g15BM8="
19888
19888
  }
package/CHANGELOG.md CHANGED
@@ -1,4 +1,19 @@
1
1
 
2
+ ## [0.22.14](https://github.com/btc-embedded/cdk-extensions/compare/v0.22.13...v0.22.14) (2026-02-26)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * **cli:** improve stack-diagnose fallback log retrieval ([73616eb](https://github.com/btc-embedded/cdk-extensions/commit/73616eb32e84586ed916f0d5075f785292befe59))
8
+
9
+ ## [0.22.13](https://github.com/btc-embedded/cdk-extensions/compare/v0.22.12...v0.22.13) (2026-02-26)
10
+
11
+
12
+ ### Features
13
+
14
+ * **cli:** improve stack-diagnose ECS diagnostics ([8540e0c](https://github.com/btc-embedded/cdk-extensions/commit/8540e0c576163b43892460f50e1301cd112995e5))
15
+ * **cli:** refactor stack-diagnose and improve ECS diagnostics ([4699601](https://github.com/btc-embedded/cdk-extensions/commit/4699601e63f84bb6d9f78f9ebbcfec051406fb67))
16
+
2
17
  ## [0.22.12](https://github.com/btc-embedded/cdk-extensions/compare/v0.22.11...v0.22.12) (2026-02-25)
3
18
 
4
19
 
package/README.md CHANGED
@@ -77,93 +77,67 @@ createApplicationApp({
77
77
 
78
78
  ### catnip — Cloud Toolkit by the CAT Department
79
79
 
80
- The `catnip` CLI tool provides commands for cloud infrastructure diagnostics and management.
80
+ `catnip` provides operational helpers for CloudFormation, ECS, and Cognito.
81
+
82
+ Global options (apply to all commands):
83
+ - `--region <region>` — AWS region (defaults to `AWS_DEFAULT_REGION` / `AWS_REGION`)
84
+ - `--profile <profile>` — AWS named profile
81
85
 
82
86
  #### stack-diagnose
83
87
 
84
- Diagnose CloudFormation stack deployment failures.
88
+ Diagnose failed CloudFormation deployments and show ECS failure context.
85
89
 
86
- **Usage:**
90
+ Usage:
87
91
 
88
92
  ```bash
89
- # Auto-detect and diagnose the last failed stack
90
93
  catnip stack-diagnose
91
-
92
- # Diagnose a specific stack
93
94
  catnip stack-diagnose --stack-name my-stack
94
-
95
- # Customize log output and task inspection
95
+ catnip stack-diagnose --stage prod
96
96
  catnip stack-diagnose --stack-name my-stack --tail 200 --tasks 10
97
97
  ```
98
98
 
99
- **Description:**
100
-
101
- The `stack-diagnose` command provides comprehensive diagnostics for failed CloudFormation stacks. If no stack name is provided, it automatically detects and diagnoses the last failed stack in your AWS account. The command displays:
102
-
103
- - **Stack Status**: Current CloudFormation stack status and reason for failure
104
- - **CloudFormation Events**: Recent stack events showing what failed during deployment
105
- - **ECS Diagnostics** (if applicable): If the stack contains ECS services, additional diagnostics are performed including:
106
- - Service event history
107
- - Recent stopped task logs
108
- - Container output for troubleshooting
109
-
110
- **Options:**
111
-
112
- - `--stack-name <name>` — CloudFormation stack name (optional; auto-detects last failed stack if omitted)
113
- - `--stage <name>` — Filter stacks by stage name (e.g., 'prod', 'dev') when auto-detecting; only used if --stack-name is not provided
99
+ Options:
100
+ - `--stack-name <name>` — stack to diagnose (optional; auto-detects last failed stack if omitted)
101
+ - `--stage <name>` stage filter for auto-detection (ignored if `--stack-name` is provided)
114
102
  - `--tail <n>` — Number of log lines to show per container (default: 100)
115
103
  - `--tasks <n>` — Number of recent stopped tasks to inspect (default: 5)
116
- - `--region <region>` — AWS region (uses AWS_DEFAULT_REGION / AWS_REGION environment variable if not specified)
117
- - `--profile <profile>` — AWS named profile for local development
118
-
119
- **Examples:**
120
-
121
- ```bash
122
- # Quick diagnosis of last failed stack
123
- catnip stack-diagnose
124
-
125
- # Auto-detect failed stack for a specific stage (useful when multiple stages in same account)
126
- catnip stack-diagnose --stage prod
127
-
128
- # Diagnose specific stack with extended logging
129
- catnip stack-diagnose --stack-name prod-api-stack --tail 500 --tasks 10
130
-
131
- # Use specific AWS profile and region
132
- catnip stack-diagnose --profile my-profile --region eu-central-1
133
- ```
134
104
 
135
105
  #### ecs-logs
136
106
 
137
107
  Stream live logs from running ECS services in a CloudFormation stack.
138
108
 
139
- **Usage:**
109
+ Usage:
140
110
 
141
111
  ```bash
142
- # Stream logs from all ECS services in a stack
143
- npx catnip ecs-logs --stack-name my-stack
144
-
145
- # Follow logs in real-time
146
- npx catnip ecs-logs --stack-name my-stack --follow
147
-
148
- # Filter by service name and show last 50 lines
149
- npx catnip ecs-logs --stack-name my-stack --tail 50 --service api
150
-
151
- # Raw JSON output (for piping to jq or pino-pretty)
152
- npx catnip ecs-logs --stack-name my-stack --output raw
153
-
154
- # Pretty-printed JSON with colors
155
- npx catnip ecs-logs --stack-name my-stack --output pretty
112
+ catnip ecs-logs --stack-name my-stack
113
+ catnip ecs-logs --stack-name my-stack --follow
114
+ catnip ecs-logs --stack-name my-stack --service api --tail 50
115
+ catnip ecs-logs --stack-name my-stack --output raw
116
+ catnip ecs-logs --stack-name my-stack --output pretty
156
117
  ```
157
118
 
158
- **Options:**
159
-
119
+ Options:
160
120
  - `--stack-name <name>` — CloudFormation stack name (required)
161
121
  - `--tail <n>` — Lines of history to show per container (default: 100)
162
122
  - `-f, --follow` — Keep polling for new log events
163
123
  - `--service <name>` — Filter services by name
164
124
  - `-o, --output <mode>` — Output mode: `text`, `raw`, or `pretty` (default: text)
165
- - `--region <region>` — AWS region
166
- - `--profile <profile>` — AWS profile
125
+
126
+ #### oidc-token
127
+
128
+ Fetch a Cognito token using CloudFormation exports from a stack.
129
+
130
+ Usage:
131
+
132
+ ```bash
133
+ catnip oidc-token --stack-name my-stack
134
+ catnip oidc-token --stack-name my-stack --output json
135
+ ```
136
+
137
+ Options:
138
+ - `--stack-name <name>` — stack that exported Cognito resources (required)
139
+ - `--output <token|json>` — print token only, or full response JSON (default: `token`)
140
+ - `token` output is the `access_token`
167
141
 
168
142
  ## Documentation
169
143