konokenj.cdk-api-mcp-server 0.32.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 +13 -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-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-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-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-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.32.0.dist-info → konokenj_cdk_api_mcp_server-0.33.0.dist-info}/METADATA +2 -2
- {konokenj_cdk_api_mcp_server-0.32.0.dist-info → konokenj_cdk_api_mcp_server-0.33.0.dist-info}/RECORD +35 -29
- {konokenj_cdk_api_mcp_server-0.32.0.dist-info → konokenj_cdk_api_mcp_server-0.33.0.dist-info}/WHEEL +0 -0
- {konokenj_cdk_api_mcp_server-0.32.0.dist-info → konokenj_cdk_api_mcp_server-0.33.0.dist-info}/entry_points.txt +0 -0
- {konokenj_cdk_api_mcp_server-0.32.0.dist-info → konokenj_cdk_api_mcp_server-0.33.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -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
|
+
});
|
|
@@ -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
|
});
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-events/integ.api-destination.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { App, CfnOutput, SecretValue, Stack } from 'aws-cdk-lib';
|
|
2
|
+
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
3
|
+
import * as events from 'aws-cdk-lib/aws-events';
|
|
4
|
+
import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
|
|
5
|
+
|
|
6
|
+
const app = new App();
|
|
7
|
+
|
|
8
|
+
const stack = new Stack(app, 'events-api-destination-stack');
|
|
9
|
+
|
|
10
|
+
const secret = new secretsmanager.Secret(stack, 'Secret', {
|
|
11
|
+
secretStringValue: SecretValue.unsafePlainText('abc123'),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const connection = new events.Connection(stack, 'Connection', {
|
|
15
|
+
authorization: events.Authorization.apiKey('x-api-key', secret.secretValue),
|
|
16
|
+
description: 'Connection with API Key x-api-key',
|
|
17
|
+
connectionName: 'MyConnection',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const destination = new events.ApiDestination(stack, 'Destination', {
|
|
21
|
+
connection,
|
|
22
|
+
endpoint: 'https://httpbin.org/headers',
|
|
23
|
+
httpMethod: events.HttpMethod.GET,
|
|
24
|
+
apiDestinationName: 'MyDestination',
|
|
25
|
+
rateLimitPerSecond: 1,
|
|
26
|
+
description: 'Calling example.com with API key x-api-key',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// arn:aws:events:{region}:{account}:api-destination/{destination-name}/11111111-1111-1111-1111-111111111111
|
|
30
|
+
new CfnOutput(stack, 'DestinationArn', {
|
|
31
|
+
value: destination.apiDestinationArn,
|
|
32
|
+
description: 'The ARN of the API destination',
|
|
33
|
+
});
|
|
34
|
+
// arn:aws:events:{region}:{account}:api-destination/{destination-name}
|
|
35
|
+
new CfnOutput(stack, 'DestinationArnForPolicy', {
|
|
36
|
+
value: destination.apiDestinationArnForPolicy || '',
|
|
37
|
+
description: 'The ARN of the API destination in resource format',
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
new IntegTest(app, 'events-api-destination-integ', {
|
|
41
|
+
testCases: [stack],
|
|
42
|
+
});
|
|
@@ -369,11 +369,16 @@ const connection = events.Connection.fromEventBusArn(
|
|
|
369
369
|
'arn:aws:secretsmanager:us-east-1:123456789012:secret:SecretName-f3gDy9',
|
|
370
370
|
);
|
|
371
371
|
|
|
372
|
-
const apiDestinationArn = 'arn:aws:events:us-east-1:123456789012:api-destination/DestinationName';
|
|
372
|
+
const apiDestinationArn = 'arn:aws:events:us-east-1:123456789012:api-destination/DestinationName/11111111-1111-1111-1111-111111111111';
|
|
373
|
+
const apiDestinationArnForPolicy = 'arn:aws:events:us-east-1:123456789012:api-destination/DestinationName';
|
|
373
374
|
const destination = events.ApiDestination.fromApiDestinationAttributes(
|
|
374
375
|
this,
|
|
375
376
|
'Destination',
|
|
376
|
-
{
|
|
377
|
+
{
|
|
378
|
+
apiDestinationArn,
|
|
379
|
+
connection,
|
|
380
|
+
apiDestinationArnForPolicy // optional
|
|
381
|
+
},
|
|
377
382
|
);
|
|
378
383
|
|
|
379
384
|
const rule = new events.Rule(this, 'OtherRule', {
|
|
@@ -102,10 +102,13 @@ will be used for files successfully delivered to S3. `errorOutputPrefix` will be
|
|
|
102
102
|
failed records before writing them to S3.
|
|
103
103
|
|
|
104
104
|
```ts
|
|
105
|
+
import { TimeZone } from 'aws-cdk-lib';
|
|
105
106
|
declare const bucket: s3.Bucket;
|
|
106
107
|
const s3Destination = new firehose.S3Bucket(bucket, {
|
|
107
108
|
dataOutputPrefix: 'myFirehose/DeliveredYear=!{timestamp:yyyy}/anyMonth/rand=!{firehose:random-string}',
|
|
108
109
|
errorOutputPrefix: 'myFirehoseFailures/!{firehose:error-output-type}/!{timestamp:yyyy}/anyMonth/!{timestamp:dd}',
|
|
110
|
+
// The time zone of timestamps (default UTC)
|
|
111
|
+
timeZone: TimeZone.ASIA_TOKYO,
|
|
109
112
|
});
|
|
110
113
|
```
|
|
111
114
|
|
|
@@ -56,6 +56,7 @@ const deliveryStream = new firehose.DeliveryStream(stack, 'DeliveryStream', {
|
|
|
56
56
|
dataOutputPrefix: 'regularPrefix',
|
|
57
57
|
errorOutputPrefix: 'errorPrefix',
|
|
58
58
|
fileExtension: '.log.gz',
|
|
59
|
+
timeZone: cdk.TimeZone.ASIA_TOKYO,
|
|
59
60
|
bufferingInterval: cdk.Duration.seconds(60),
|
|
60
61
|
bufferingSize: cdk.Size.mebibytes(1),
|
|
61
62
|
encryptionKey: key,
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as cdk from 'aws-cdk-lib';
|
|
2
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
3
|
+
import * as iam from 'aws-cdk-lib/aws-iam';
|
|
4
|
+
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
5
|
+
|
|
6
|
+
const app = new cdk.App({
|
|
7
|
+
postCliContext: {
|
|
8
|
+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
const stack = new cdk.Stack(app, 'stack');
|
|
12
|
+
|
|
13
|
+
const mappingName = 'testmapping';
|
|
14
|
+
const mapping = new cdk.CfnMapping(stack, 'testmapping', {
|
|
15
|
+
mapping: {
|
|
16
|
+
us: {
|
|
17
|
+
regionalModels:
|
|
18
|
+
'arn:aws:bedrock:us-west-2::foundation-model/amazon.nova-lite-v1:0',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
mapping.overrideLogicalId(mappingName);
|
|
23
|
+
|
|
24
|
+
const func = new lambda.Function(stack, 'test-function', {
|
|
25
|
+
code: new lambda.InlineCode('exports.handler = async (event) => { console.log(event); return {\'statusCode\': 200, \'body\': \'\'}; }'),
|
|
26
|
+
runtime: lambda.Runtime.NODEJS_20_X,
|
|
27
|
+
handler: 'index.handler',
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Literal resources in statement
|
|
31
|
+
func.addToRolePolicy(new iam.PolicyStatement({
|
|
32
|
+
actions: ['bedrock:Invoke*'],
|
|
33
|
+
resources: [
|
|
34
|
+
'*',
|
|
35
|
+
],
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
// Array token resources in statement
|
|
39
|
+
func.addToRolePolicy(new iam.PolicyStatement({
|
|
40
|
+
actions: ['bedrock:Invoke*'],
|
|
41
|
+
resources: cdk.Fn.split(',', cdk.Fn.findInMap(mappingName, 'us', 'regionalModels')),
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
new integ.IntegTest(app, 'lambda-policy-with-token-resolution', {
|
|
45
|
+
testCases: [stack],
|
|
46
|
+
});
|
|
@@ -6,7 +6,7 @@ import * as targets from 'aws-cdk-lib/aws-route53-targets';
|
|
|
6
6
|
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
7
7
|
import * as elasticbeanstalk from 'aws-cdk-lib/aws-elasticbeanstalk';
|
|
8
8
|
import * as custom from 'aws-cdk-lib/custom-resources';
|
|
9
|
-
import { RegionInfo } from 'aws-cdk
|
|
9
|
+
import { RegionInfo } from '@aws-cdk/region-info';
|
|
10
10
|
|
|
11
11
|
const app = new App({
|
|
12
12
|
postCliContext: {
|