konokenj.cdk-api-mcp-server 0.31.0__py3-none-any.whl → 0.33.0__py3-none-any.whl
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.
Potentially problematic release.
This version of konokenj.cdk-api-mcp-server might be problematic. Click here for more details.
- cdk_api_mcp_server/__about__.py +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/integ.api-dualstack.ts +3 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/integ.api.ts +2 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/integ.stage.ts +7 -20
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-authorizers/integ.iam.ts +34 -38
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.sqs.ts +58 -71
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudfront/README.md +292 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch/README.md +71 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch/integ.alarm-and-dashboard.ts +12 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch/integ.dashboard-with-metric-id-and-visible.ts +70 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/README.md +67 -3
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-s3-cache.ts +71 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecr-assets/integ.assets-docker.ts +6 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.availability-zone-rebalancing.ts +14 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.enable-execute-command.ts +35 -29
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.exec-command.ts +16 -22
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.lb-awsvpc-nw.ts +26 -16
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.pseudo-terminal.ts +18 -8
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-events/integ.api-destination.ts +42 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-events-targets/README.md +7 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-iam/integ.custom-permissions-boundary-aspect.ts +50 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/README.md +3 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/integ.s3-bucket.lit.ts +1 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.lambda-policy-with-token-resolution.ts +46 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/README.md +19 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.cluster-lookup.ts +100 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53-targets/integ.elastic-beanstalk-hostedzoneid.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.invoke-jsonata.ts +87 -80
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.invoke.ts +87 -69
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.start-job-run.ts +96 -43
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/README.md +40 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/integ.canary-resources-to-replicate-tags.ts +36 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/integ.canary-retry.ts +32 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +29 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/pipelines/integ.pipeline-with-customsynthesizer.ts +105 -0
- {konokenj_cdk_api_mcp_server-0.31.0.dist-info → konokenj_cdk_api_mcp_server-0.33.0.dist-info}/METADATA +2 -2
- {konokenj_cdk_api_mcp_server-0.31.0.dist-info → konokenj_cdk_api_mcp_server-0.33.0.dist-info}/RECORD +40 -31
- {konokenj_cdk_api_mcp_server-0.31.0.dist-info → konokenj_cdk_api_mcp_server-0.33.0.dist-info}/WHEEL +0 -0
- {konokenj_cdk_api_mcp_server-0.31.0.dist-info → konokenj_cdk_api_mcp_server-0.33.0.dist-info}/entry_points.txt +0 -0
- {konokenj_cdk_api_mcp_server-0.31.0.dist-info → konokenj_cdk_api_mcp_server-0.33.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -53,6 +53,39 @@ const metric = new cloudwatch.Metric({
|
|
|
53
53
|
});
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
### Metric ID
|
|
57
|
+
|
|
58
|
+
Metrics can be assigned a unique identifier using the `id` property. This is
|
|
59
|
+
useful when referencing metrics in math expressions:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
const metric = new cloudwatch.Metric({
|
|
63
|
+
namespace: 'AWS/Lambda',
|
|
64
|
+
metricName: 'Invocations',
|
|
65
|
+
dimensionsMap: {
|
|
66
|
+
FunctionName: 'MyFunction'
|
|
67
|
+
},
|
|
68
|
+
id: 'invocations'
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The `id` must start with a lowercase letter and can only contain letters, numbers, and underscores.
|
|
73
|
+
|
|
74
|
+
### Metric Visible
|
|
75
|
+
Metrics can be hidden from dashboard graphs using the `visible` property:
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
declare const fn: lambda.Function;
|
|
79
|
+
|
|
80
|
+
const metric = fn.metricErrors({
|
|
81
|
+
visible: false
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
By default, all metrics are visible (`visible: true`). Setting `visible: false`
|
|
86
|
+
hides the metric from dashboard visualizations while still allowing it to be
|
|
87
|
+
used in math expressions given that it has an `id` set to it.
|
|
88
|
+
|
|
56
89
|
### Metric Math
|
|
57
90
|
|
|
58
91
|
Math expressions are supported by instantiating the `MathExpression` class.
|
|
@@ -86,6 +119,31 @@ const problemPercentage = new cloudwatch.MathExpression({
|
|
|
86
119
|
});
|
|
87
120
|
```
|
|
88
121
|
|
|
122
|
+
### Metric ID Usage in Math Expressions
|
|
123
|
+
|
|
124
|
+
When metrics have custom IDs, you can reference them directly in math expressions.
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
declare const fn: lambda.Function;
|
|
128
|
+
|
|
129
|
+
const invocations = fn.metricInvocations({
|
|
130
|
+
id: 'lambda_invocations',
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const errors = fn.metricErrors({
|
|
134
|
+
id: 'lambda_errors',
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
When metrics have predefined IDs, they can be referenced directly in math expressions by their ID without requiring the `usingMetrics` property.
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
const errorRate = new cloudwatch.MathExpression({
|
|
142
|
+
expression: 'lambda_errors / lambda_invocations * 100',
|
|
143
|
+
label: 'Error Rate (%)',
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
89
147
|
### Search Expressions
|
|
90
148
|
|
|
91
149
|
Math expressions also support search expressions. For example, the following
|
|
@@ -790,6 +848,19 @@ dashboard.addWidgets(new cloudwatch.LogQueryWidget({
|
|
|
790
848
|
}));
|
|
791
849
|
```
|
|
792
850
|
|
|
851
|
+
Log Insights QL is the default query language. You may specify an [alternate query language: OpenSearch PPL or SQL](https://aws.amazon.com/blogs/aws/new-amazon-cloudwatch-and-amazon-opensearch-service-launch-an-integrated-analytics-experience/), if desired:
|
|
852
|
+
|
|
853
|
+
```ts
|
|
854
|
+
declare const dashboard: cloudwatch.Dashboard;
|
|
855
|
+
|
|
856
|
+
dashboard.addWidgets(new cloudwatch.LogQueryWidget({
|
|
857
|
+
logGroupNames: ['my-log-group'],
|
|
858
|
+
view: cloudwatch.LogQueryVisualizationType.TABLE,
|
|
859
|
+
queryString: "SELECT count(*) as count FROM 'my-log-group'",
|
|
860
|
+
queryLanguage: cloudwatch.LogQueryLanguage.SQL,
|
|
861
|
+
}));
|
|
862
|
+
```
|
|
863
|
+
|
|
793
864
|
### Custom widget
|
|
794
865
|
|
|
795
866
|
A `CustomWidget` shows the result of an AWS Lambda function:
|
|
@@ -94,6 +94,18 @@ dashboard.addWidgets(new cloudwatch.LogQueryWidget({
|
|
|
94
94
|
| filter @message like /Error/`,
|
|
95
95
|
accountId: '123456789012',
|
|
96
96
|
}));
|
|
97
|
+
dashboard.addWidgets(new cloudwatch.LogQueryWidget({
|
|
98
|
+
title: 'Errors in my log group - SQL',
|
|
99
|
+
logGroupNames: ['my-log-group'],
|
|
100
|
+
queryString: "SELECT count(*) as count FROM 'my-log-group'",
|
|
101
|
+
queryLanguage: cloudwatch.LogQueryLanguage.SQL,
|
|
102
|
+
}));
|
|
103
|
+
dashboard.addWidgets(new cloudwatch.LogQueryWidget({
|
|
104
|
+
title: 'Errors in my log group - PPL',
|
|
105
|
+
logGroupNames: ['my-log-group'],
|
|
106
|
+
queryString: 'fields `@message`\ | sort - `@timestamp`',
|
|
107
|
+
queryLanguage: cloudwatch.LogQueryLanguage.PPL,
|
|
108
|
+
}));
|
|
97
109
|
dashboard.addWidgets(new cloudwatch.SingleValueWidget({
|
|
98
110
|
title: 'Sent message size',
|
|
99
111
|
metrics: [sentMessageSizeMetric],
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { App, Stack, StackProps } from 'aws-cdk-lib';
|
|
2
|
+
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
3
|
+
import { Dashboard, Metric, GraphWidget, MathExpression } from 'aws-cdk-lib/aws-cloudwatch';
|
|
4
|
+
|
|
5
|
+
class DashboardWithMetricIdAndVisibleIntegrationTest extends Stack {
|
|
6
|
+
constructor(scope: App, id: string, props?: StackProps) {
|
|
7
|
+
super(scope, id, props);
|
|
8
|
+
|
|
9
|
+
const dashboard = new Dashboard(this, 'Dash');
|
|
10
|
+
|
|
11
|
+
const lambdaInvocations = new Metric({
|
|
12
|
+
namespace: 'AWS/Lambda',
|
|
13
|
+
metricName: 'Invocations',
|
|
14
|
+
dimensionsMap: { FunctionName: 'test-function' },
|
|
15
|
+
label: 'Lambda Invocations',
|
|
16
|
+
id: 'lambda_invocations',
|
|
17
|
+
visible: true,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const lambdaErrors = new Metric({
|
|
21
|
+
namespace: 'AWS/Lambda',
|
|
22
|
+
metricName: 'Errors',
|
|
23
|
+
dimensionsMap: { FunctionName: 'test-function' },
|
|
24
|
+
label: 'Lambda Errors (Hidden for calculation)',
|
|
25
|
+
id: 'lambda_errors',
|
|
26
|
+
visible: false,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const lambdaDuration = new Metric({
|
|
30
|
+
namespace: 'AWS/Lambda',
|
|
31
|
+
metricName: 'Duration',
|
|
32
|
+
dimensionsMap: { FunctionName: 'test-function' },
|
|
33
|
+
label: 'Lambda Duration',
|
|
34
|
+
id: 'lambda_duration',
|
|
35
|
+
visible: true,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const lambdaThrottles = new Metric({
|
|
39
|
+
namespace: 'AWS/Lambda',
|
|
40
|
+
metricName: 'Throttles',
|
|
41
|
+
dimensionsMap: { FunctionName: 'test-function' },
|
|
42
|
+
label: 'Lambda Throttles (Hidden)',
|
|
43
|
+
id: 'lambda_throttles',
|
|
44
|
+
visible: false,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const errorRate = new MathExpression({
|
|
48
|
+
expression: 'lambda_errors / lambda_invocations * 100',
|
|
49
|
+
label: 'Error Rate (%)',
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const widget = new GraphWidget({
|
|
53
|
+
title: 'Lambda Metrics with ID and Visible Properties',
|
|
54
|
+
left: [
|
|
55
|
+
lambdaInvocations,
|
|
56
|
+
lambdaErrors,
|
|
57
|
+
lambdaDuration,
|
|
58
|
+
lambdaThrottles,
|
|
59
|
+
errorRate,
|
|
60
|
+
],
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
dashboard.addWidgets(widget);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const app = new App();
|
|
68
|
+
new IntegTest(app, 'cdk-integ-dashboard-with-metric-id-and-visible', {
|
|
69
|
+
testCases: [new DashboardWithMetricIdAndVisibleIntegrationTest(app, 'DashboardWithMetricIdAndVisibleIntegrationTest')],
|
|
70
|
+
});
|
|
@@ -258,9 +258,73 @@ new codebuild.Project(this, 'Project', {
|
|
|
258
258
|
});
|
|
259
259
|
```
|
|
260
260
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
the
|
|
261
|
+
If you want to [share the same cache between multiple projects](https://docs.aws.amazon.com/codebuild/latest/userguide/caching-s3.html#caching-s3-sharing), you must must do the following:
|
|
262
|
+
|
|
263
|
+
- Use the same `cacheNamespace`.
|
|
264
|
+
- Specify the same cache key.
|
|
265
|
+
- Define identical cache paths.
|
|
266
|
+
- Use the same Amazon S3 buckets and `pathPrefix` if set.
|
|
267
|
+
|
|
268
|
+
```ts
|
|
269
|
+
declare const sourceBucket: s3.Bucket;
|
|
270
|
+
declare const myCachingBucket: s3.Bucket;
|
|
271
|
+
|
|
272
|
+
new codebuild.Project(this, 'ProjectA', {
|
|
273
|
+
source: codebuild.Source.s3({
|
|
274
|
+
bucket: sourceBucket,
|
|
275
|
+
path: 'path/to/source-a.zip',
|
|
276
|
+
}),
|
|
277
|
+
// configure the same bucket and path prefix
|
|
278
|
+
cache: codebuild.Cache.bucket(myCachingBucket, {
|
|
279
|
+
prefix: 'cache',
|
|
280
|
+
// use the same cache namespace
|
|
281
|
+
cacheNamespace: 'cache-namespace',
|
|
282
|
+
}),
|
|
283
|
+
buildSpec: codebuild.BuildSpec.fromObject({
|
|
284
|
+
version: '0.2',
|
|
285
|
+
phases: {
|
|
286
|
+
build: {
|
|
287
|
+
commands: ['...'],
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
// specify the same cache key and paths
|
|
291
|
+
cache: {
|
|
292
|
+
key: 'unique-key',
|
|
293
|
+
paths: [
|
|
294
|
+
'/root/cachedir/**/*',
|
|
295
|
+
],
|
|
296
|
+
},
|
|
297
|
+
}),
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
new codebuild.Project(this, 'ProjectB', {
|
|
301
|
+
source: codebuild.Source.s3({
|
|
302
|
+
bucket: sourceBucket,
|
|
303
|
+
path: 'path/to/source-b.zip',
|
|
304
|
+
}),
|
|
305
|
+
// configure the same bucket and path prefix
|
|
306
|
+
cache: codebuild.Cache.bucket(myCachingBucket, {
|
|
307
|
+
prefix: 'cache',
|
|
308
|
+
// use the same cache namespace
|
|
309
|
+
cacheNamespace: 'cache-namespace',
|
|
310
|
+
}),
|
|
311
|
+
buildSpec: codebuild.BuildSpec.fromObject({
|
|
312
|
+
version: '0.2',
|
|
313
|
+
phases: {
|
|
314
|
+
build: {
|
|
315
|
+
commands: ['...'],
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
// specify the same cache key and paths
|
|
319
|
+
cache: {
|
|
320
|
+
key: 'unique-key',
|
|
321
|
+
paths: [
|
|
322
|
+
'/root/cachedir/**/*',
|
|
323
|
+
],
|
|
324
|
+
},
|
|
325
|
+
}),
|
|
326
|
+
});
|
|
327
|
+
```
|
|
264
328
|
|
|
265
329
|
### Local Caching
|
|
266
330
|
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-s3-cache.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
3
|
+
import * as cdk from 'aws-cdk-lib';
|
|
4
|
+
import * as codebuild from 'aws-cdk-lib/aws-codebuild';
|
|
5
|
+
import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
6
|
+
|
|
7
|
+
const app = new cdk.App();
|
|
8
|
+
|
|
9
|
+
const stack = new cdk.Stack(app, 'codebuild-s3-cache-stack');
|
|
10
|
+
|
|
11
|
+
const bucket = new s3.Bucket(stack, 'MyBucket', {
|
|
12
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
13
|
+
autoDeleteObjects: true,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const buildSpec = codebuild.BuildSpec.fromObject({
|
|
17
|
+
version: '0.2',
|
|
18
|
+
phases: {
|
|
19
|
+
build: {
|
|
20
|
+
commands: ['echo "Hello, CodeBuild!"'],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
cache: {
|
|
24
|
+
paths: [
|
|
25
|
+
'/root/cachedir/**/*',
|
|
26
|
+
],
|
|
27
|
+
key: 'unique-key',
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const projectA = new codebuild.Project(stack, 'ProjectA', {
|
|
32
|
+
source: codebuild.Source.s3({
|
|
33
|
+
bucket,
|
|
34
|
+
path: 'path/to/source-a.zip',
|
|
35
|
+
}),
|
|
36
|
+
cache: codebuild.Cache.bucket(bucket, {
|
|
37
|
+
prefix: 'cache',
|
|
38
|
+
cacheNamespace: 'cache-namespace',
|
|
39
|
+
}),
|
|
40
|
+
buildSpec,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const projectB = new codebuild.Project(stack, 'ProjectB', {
|
|
44
|
+
source: codebuild.Source.s3({
|
|
45
|
+
bucket,
|
|
46
|
+
path: 'path/to/source-b.zip',
|
|
47
|
+
}),
|
|
48
|
+
cache: codebuild.Cache.bucket(bucket, {
|
|
49
|
+
prefix: 'cache',
|
|
50
|
+
cacheNamespace: 'cache-namespace',
|
|
51
|
+
}),
|
|
52
|
+
buildSpec,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const integ = new IntegTest(app, 'codebuild-s3-cache-integ', {
|
|
56
|
+
testCases: [stack],
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
[projectA, projectB].forEach((project) => {
|
|
60
|
+
integ.assertions.awsApiCall('CodeBuild', 'batchGetProjects', {
|
|
61
|
+
names: [project.projectName],
|
|
62
|
+
}).expect(ExpectedResult.objectLike({
|
|
63
|
+
projects: [{
|
|
64
|
+
cache: {
|
|
65
|
+
type: 'S3',
|
|
66
|
+
location: `${bucket.bucketName}/cache`,
|
|
67
|
+
cacheNamespace: 'cache-namespace',
|
|
68
|
+
},
|
|
69
|
+
}],
|
|
70
|
+
}));
|
|
71
|
+
});
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecr-assets/integ.assets-docker.ts
CHANGED
|
@@ -46,6 +46,10 @@ const asset8 = new assets.DockerImageAsset(stack, 'DockerImage8', {
|
|
|
46
46
|
cacheDisabled: true,
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
+
const asset9 = new assets.DockerImageAsset(stack, 'DockerImage9', {
|
|
50
|
+
directory: path.join(__dirname, 'demo-image-dockerignore'),
|
|
51
|
+
});
|
|
52
|
+
|
|
49
53
|
const user = new iam.User(stack, 'MyUser');
|
|
50
54
|
asset.repository.grantPull(user);
|
|
51
55
|
asset2.repository.grantPull(user);
|
|
@@ -55,6 +59,7 @@ asset5.repository.grantPull(user);
|
|
|
55
59
|
asset6.repository.grantPull(user);
|
|
56
60
|
asset7.repository.grantPull(user);
|
|
57
61
|
asset8.repository.grantPull(user);
|
|
62
|
+
asset9.repository.grantPull(user);
|
|
58
63
|
|
|
59
64
|
new cdk.CfnOutput(stack, 'ImageUri', { value: asset.imageUri });
|
|
60
65
|
new cdk.CfnOutput(stack, 'ImageUri2', { value: asset2.imageUri });
|
|
@@ -64,5 +69,6 @@ new cdk.CfnOutput(stack, 'ImageUri5', { value: asset5.imageUri });
|
|
|
64
69
|
new cdk.CfnOutput(stack, 'ImageUri6', { value: asset6.imageUri });
|
|
65
70
|
new cdk.CfnOutput(stack, 'ImageUri7', { value: asset7.imageUri });
|
|
66
71
|
new cdk.CfnOutput(stack, 'ImageUri8', { value: asset8.imageUri });
|
|
72
|
+
new cdk.CfnOutput(stack, 'ImageUri9', { value: asset9.imageUri });
|
|
67
73
|
|
|
68
74
|
app.synth();
|
|
@@ -3,20 +3,30 @@ import * as cdk from 'aws-cdk-lib';
|
|
|
3
3
|
import * as ecs from 'aws-cdk-lib/aws-ecs';
|
|
4
4
|
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
5
5
|
|
|
6
|
-
const app = new cdk.App(
|
|
6
|
+
const app = new cdk.App({
|
|
7
|
+
postCliContext: {
|
|
8
|
+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
|
|
9
|
+
'@aws-cdk/aws-lambda:createNewPoliciesWithAddToRolePolicy': false,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
7
12
|
const stack = new cdk.Stack(app, 'aws-ecs-integ-availability-zone-rebalancing');
|
|
8
13
|
|
|
9
14
|
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2, restrictDefaultSecurityGroup: false });
|
|
10
15
|
|
|
11
|
-
const cluster = new ecs.Cluster(stack, '
|
|
16
|
+
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
|
|
17
|
+
|
|
18
|
+
cluster.addCapacity('DefaultAutoScalingGroup', {
|
|
19
|
+
instanceType: new ec2.InstanceType('t2.micro'),
|
|
20
|
+
});
|
|
12
21
|
|
|
13
|
-
const taskDefinition = new ecs.
|
|
22
|
+
const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef');
|
|
14
23
|
|
|
15
24
|
taskDefinition.addContainer('web', {
|
|
16
25
|
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
|
|
26
|
+
memoryLimitMiB: 256,
|
|
17
27
|
});
|
|
18
28
|
|
|
19
|
-
new ecs.
|
|
29
|
+
new ecs.Ec2Service(stack, 'FrontendService', {
|
|
20
30
|
cluster,
|
|
21
31
|
taskDefinition,
|
|
22
32
|
availabilityZoneRebalancing: ecs.AvailabilityZoneRebalancing.ENABLED,
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.enable-execute-command.ts
CHANGED
|
@@ -1,30 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
import * as
|
|
1
|
+
|
|
2
|
+
import * as autoscaling from 'aws-cdk-lib/aws-autoscaling';
|
|
3
3
|
import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
4
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
4
5
|
import * as cdk from 'aws-cdk-lib';
|
|
5
|
-
import { Duration } from 'aws-cdk-lib';
|
|
6
6
|
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
7
7
|
import * as ecs from 'aws-cdk-lib/aws-ecs';
|
|
8
8
|
|
|
9
9
|
const app = new cdk.App({
|
|
10
10
|
postCliContext: {
|
|
11
|
+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
|
|
11
12
|
'@aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions': true,
|
|
13
|
+
'@aws-cdk/aws-ecs:enableImdsBlockingDeprecatedFeature': false,
|
|
14
|
+
'@aws-cdk/aws-ecs:disableEcsImdsBlocking': false,
|
|
15
|
+
'@aws-cdk/aws-lambda:createNewPoliciesWithAddToRolePolicy': false,
|
|
12
16
|
},
|
|
13
17
|
});
|
|
14
18
|
const stack = new cdk.Stack(app, 'aws-ecs-integ-enable-execute-command');
|
|
15
19
|
|
|
16
|
-
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2
|
|
20
|
+
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
|
|
21
|
+
|
|
22
|
+
const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef');
|
|
23
|
+
|
|
24
|
+
taskDefinition.addContainer('web', {
|
|
25
|
+
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
|
|
26
|
+
memoryReservationMiB: 256,
|
|
27
|
+
portMappings: [
|
|
28
|
+
{
|
|
29
|
+
containerPort: 80,
|
|
30
|
+
hostPort: 8080,
|
|
31
|
+
protocol: ecs.Protocol.TCP,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
});
|
|
17
35
|
|
|
18
|
-
const
|
|
36
|
+
const execBucket = new s3.Bucket(stack, 'EcsExecBucket');
|
|
19
37
|
|
|
20
|
-
const
|
|
21
|
-
|
|
38
|
+
const cp = new ecs.AsgCapacityProvider(stack, 'EC2CapacityProvider', {
|
|
39
|
+
autoScalingGroup: new autoscaling.AutoScalingGroup(stack, 'ASG', {
|
|
40
|
+
vpc,
|
|
41
|
+
instanceType: new ec2.InstanceType('t2.micro'),
|
|
42
|
+
machineImage: ecs.EcsOptimizedImage.amazonLinux2(),
|
|
43
|
+
}),
|
|
44
|
+
// This is to allow cdk destroy to work; otherwise deletion will hang bc ASG cannot be deleted
|
|
45
|
+
enableManagedTerminationProtection: false,
|
|
22
46
|
});
|
|
23
47
|
|
|
24
|
-
const cluster = new ecs.Cluster(stack, '
|
|
48
|
+
const cluster = new ecs.Cluster(stack, 'EC2CPCluster', {
|
|
25
49
|
vpc,
|
|
26
50
|
executeCommandConfiguration: {
|
|
27
|
-
kmsKey,
|
|
28
51
|
logConfiguration: {
|
|
29
52
|
s3Bucket: execBucket,
|
|
30
53
|
s3EncryptionEnabled: true,
|
|
@@ -33,19 +56,9 @@ const cluster = new ecs.Cluster(stack, 'FargateCluster', {
|
|
|
33
56
|
logging: ecs.ExecuteCommandLogging.OVERRIDE,
|
|
34
57
|
},
|
|
35
58
|
});
|
|
59
|
+
cluster.addAsgCapacityProvider(cp);
|
|
36
60
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
taskDefinition.addContainer('web', {
|
|
40
|
-
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
|
|
41
|
-
healthCheck: {
|
|
42
|
-
command: ['CMD-SHELL', 'curl localhost:8000'],
|
|
43
|
-
interval: Duration.seconds(60),
|
|
44
|
-
timeout: Duration.seconds(40),
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
new ecs.FargateService(stack, 'FargateService', {
|
|
61
|
+
new ecs.Ec2Service(stack, 'EC2Service', {
|
|
49
62
|
cluster,
|
|
50
63
|
taskDefinition,
|
|
51
64
|
enableExecuteCommand: true,
|
|
@@ -53,12 +66,5 @@ new ecs.FargateService(stack, 'FargateService', {
|
|
|
53
66
|
|
|
54
67
|
new integ.IntegTest(app, 'enable-execute-command-test', {
|
|
55
68
|
testCases: [stack],
|
|
56
|
-
diffAssets: true,
|
|
57
|
-
cdkCommandOptions: {
|
|
58
|
-
deploy: {
|
|
59
|
-
args: {
|
|
60
|
-
rollback: true,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
69
|
});
|
|
70
|
+
app.synth();
|
|
@@ -3,11 +3,16 @@ import * as kms from 'aws-cdk-lib/aws-kms';
|
|
|
3
3
|
import * as logs from 'aws-cdk-lib/aws-logs';
|
|
4
4
|
import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
5
5
|
import * as cdk from 'aws-cdk-lib';
|
|
6
|
-
import { Duration } from 'aws-cdk-lib';
|
|
7
|
-
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
8
6
|
import * as ecs from 'aws-cdk-lib/aws-ecs';
|
|
9
7
|
|
|
10
|
-
const app = new cdk.App(
|
|
8
|
+
const app = new cdk.App({
|
|
9
|
+
postCliContext: {
|
|
10
|
+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
|
|
11
|
+
'@aws-cdk/aws-ecs:enableImdsBlockingDeprecatedFeature': false,
|
|
12
|
+
'@aws-cdk/aws-ecs:disableEcsImdsBlocking': false,
|
|
13
|
+
'@aws-cdk/aws-lambda:createNewPoliciesWithAddToRolePolicy': false,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
11
16
|
const stack = new cdk.Stack(app, 'aws-ecs-integ-exec-command');
|
|
12
17
|
|
|
13
18
|
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2, restrictDefaultSecurityGroup: false });
|
|
@@ -22,7 +27,7 @@ const execBucket = new s3.Bucket(stack, 'EcsExecBucket', {
|
|
|
22
27
|
encryptionKey: kmsKey,
|
|
23
28
|
});
|
|
24
29
|
|
|
25
|
-
const cluster = new ecs.Cluster(stack, '
|
|
30
|
+
const cluster = new ecs.Cluster(stack, 'Ec2Cluster', {
|
|
26
31
|
vpc,
|
|
27
32
|
executeCommandConfiguration: {
|
|
28
33
|
kmsKey,
|
|
@@ -36,32 +41,21 @@ const cluster = new ecs.Cluster(stack, 'FargateCluster', {
|
|
|
36
41
|
logging: ecs.ExecuteCommandLogging.OVERRIDE,
|
|
37
42
|
},
|
|
38
43
|
});
|
|
44
|
+
cluster.addCapacity('DefaultAutoScalingGroup', {
|
|
45
|
+
instanceType: new ec2.InstanceType('t2.micro'),
|
|
46
|
+
});
|
|
39
47
|
|
|
40
|
-
const taskDefinition = new ecs.
|
|
48
|
+
const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef');
|
|
41
49
|
|
|
42
50
|
taskDefinition.addContainer('web', {
|
|
43
51
|
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
|
|
44
|
-
|
|
45
|
-
command: ['CMD-SHELL', 'curl localhost:8000'],
|
|
46
|
-
interval: Duration.seconds(60),
|
|
47
|
-
timeout: Duration.seconds(40),
|
|
48
|
-
},
|
|
52
|
+
memoryLimitMiB: 256,
|
|
49
53
|
});
|
|
50
54
|
|
|
51
|
-
new ecs.
|
|
55
|
+
new ecs.Ec2Service(stack, 'Ec2Service', {
|
|
52
56
|
cluster,
|
|
53
57
|
taskDefinition,
|
|
54
58
|
enableExecuteCommand: true,
|
|
55
59
|
});
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
testCases: [stack],
|
|
59
|
-
diffAssets: true,
|
|
60
|
-
cdkCommandOptions: {
|
|
61
|
-
deploy: {
|
|
62
|
-
args: {
|
|
63
|
-
rollback: true,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
});
|
|
61
|
+
app.synth();
|
|
@@ -3,38 +3,48 @@ import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2';
|
|
|
3
3
|
import * as cdk from 'aws-cdk-lib';
|
|
4
4
|
import * as ecs from 'aws-cdk-lib/aws-ecs';
|
|
5
5
|
|
|
6
|
-
const app = new cdk.App(
|
|
6
|
+
const app = new cdk.App({
|
|
7
|
+
postCliContext: {
|
|
8
|
+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
|
|
9
|
+
'@aws-cdk/aws-ecs:enableImdsBlockingDeprecatedFeature': false,
|
|
10
|
+
'@aws-cdk/aws-ecs:disableEcsImdsBlocking': false,
|
|
11
|
+
'@aws-cdk/aws-lambda:createNewPoliciesWithAddToRolePolicy': false,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
7
14
|
const stack = new cdk.Stack(app, 'aws-ecs-integ');
|
|
8
15
|
|
|
9
16
|
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2, restrictDefaultSecurityGroup: false });
|
|
10
17
|
|
|
11
|
-
const cluster = new ecs.Cluster(stack, '
|
|
18
|
+
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
|
|
19
|
+
cluster.addCapacity('DefaultAutoScalingGroup', {
|
|
20
|
+
instanceType: new ec2.InstanceType('t2.micro'),
|
|
21
|
+
});
|
|
12
22
|
|
|
13
|
-
const taskDefinition = new ecs.
|
|
14
|
-
|
|
15
|
-
cpu: 512,
|
|
23
|
+
const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef', {
|
|
24
|
+
networkMode: ecs.NetworkMode.AWS_VPC,
|
|
16
25
|
});
|
|
17
26
|
|
|
18
|
-
taskDefinition.addContainer('web', {
|
|
27
|
+
const container = taskDefinition.addContainer('web', {
|
|
19
28
|
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
29
|
+
memoryLimitMiB: 256,
|
|
30
|
+
environment: {
|
|
31
|
+
SOME_VARIABLE: 'value',
|
|
32
|
+
},
|
|
24
33
|
});
|
|
25
34
|
|
|
26
|
-
|
|
35
|
+
container.addPortMappings({
|
|
36
|
+
containerPort: 80,
|
|
37
|
+
protocol: ecs.Protocol.TCP,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const service = new ecs.Ec2Service(stack, 'Service', {
|
|
27
41
|
cluster,
|
|
28
42
|
taskDefinition,
|
|
29
43
|
});
|
|
30
44
|
|
|
31
|
-
const scaling = service.autoScaleTaskCount({ maxCapacity: 10 });
|
|
32
|
-
// Quite low to try and force it to scale
|
|
33
|
-
scaling.scaleOnCpuUtilization('ReasonableCpu', { targetUtilizationPercent: 10 });
|
|
34
|
-
|
|
35
45
|
const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, internetFacing: true });
|
|
36
46
|
const listener = lb.addListener('PublicListener', { port: 80, open: true });
|
|
37
|
-
listener.addTargets('
|
|
47
|
+
listener.addTargets('ECS', {
|
|
38
48
|
port: 80,
|
|
39
49
|
targets: [service],
|
|
40
50
|
});
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.pseudo-terminal.ts
CHANGED
|
@@ -3,25 +3,35 @@ import * as cdk from 'aws-cdk-lib';
|
|
|
3
3
|
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
4
4
|
import * as ecs from 'aws-cdk-lib/aws-ecs';
|
|
5
5
|
|
|
6
|
-
const app = new cdk.App(
|
|
7
|
-
|
|
6
|
+
const app = new cdk.App({
|
|
7
|
+
postCliContext: {
|
|
8
|
+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
|
|
9
|
+
'@aws-cdk/aws-ecs:enableImdsBlockingDeprecatedFeature': false,
|
|
10
|
+
'@aws-cdk/aws-ecs:disableEcsImdsBlocking': false,
|
|
11
|
+
'@aws-cdk/aws-lambda:createNewPoliciesWithAddToRolePolicy': false,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
const stack = new cdk.Stack(app, 'aws-ecs-integ-pseudo-terminal');
|
|
8
15
|
|
|
9
16
|
// Create a cluster
|
|
10
17
|
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2, restrictDefaultSecurityGroup: false });
|
|
11
18
|
|
|
12
19
|
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
cluster.addCapacity('DefaultAutoScalingGroup', {
|
|
21
|
+
instanceType: new ec2.InstanceType('t2.micro'),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef', {
|
|
25
|
+
networkMode: ecs.NetworkMode.AWS_VPC,
|
|
16
26
|
});
|
|
27
|
+
|
|
17
28
|
taskDefinition.addContainer('web', {
|
|
18
29
|
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
|
|
19
|
-
memoryLimitMiB:
|
|
20
|
-
cpu: 256,
|
|
30
|
+
memoryLimitMiB: 256,
|
|
21
31
|
pseudoTerminal: true,
|
|
22
32
|
});
|
|
23
33
|
|
|
24
|
-
new ecs.
|
|
34
|
+
new ecs.Ec2Service(stack, 'Service', {
|
|
25
35
|
cluster,
|
|
26
36
|
taskDefinition,
|
|
27
37
|
});
|