konokenj.cdk-api-mcp-server 0.43.0__py3-none-any.whl → 0.45.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/aws-iot-alpha/README.md +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/README.md +8 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/integ.api.ts +4 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-batch/README.md +34 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-batch/integ.ecs-exec-batch-job.ts +148 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudfront-origins/README.md +36 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudfront-origins/integ.origin-response-completion-timeout.ts +50 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/README.md +1 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-docker-server.ts +44 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codepipeline-actions/integ.pipeline-elastic-beanstalk-deploy.ts +22 -16
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecr-assets/README.md +4 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/README.md +2 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/README.md +21 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/integ.alb-target-group-attributes.ts +45 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/integ.nlb-target-group-attributes.ts +45 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-events/README.md +18 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-events/integ.eventbus.ts +13 -3
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda-nodejs/README.md +3 -3
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda-nodejs/integ.dependencies-bun-lock.ts +50 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/README.md +20 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.proxy-endpoint.ts +36 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/README.md +24 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/integ.route53.ts +51 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53-targets/integ.cloudfront-alias-target.ts +16 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3/integ.bucket.notifications-scoped-permissions.ts +71 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions/integ.distributed-map-parallel.ts +82 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions/integ.distributed-map-redrive.ts +130 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions/integ.map-with-catch.ts +1 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/README.md +53 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.emr-create-cluster-with-ebs.ts +126 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/README.md +27 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/integ.canary-browser-type.ts +35 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cloudformation-include/integ.novalue-nonstring.ts +25 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +2 -2
- {konokenj_cdk_api_mcp_server-0.43.0.dist-info → konokenj_cdk_api_mcp_server-0.45.0.dist-info}/METADATA +2 -2
- {konokenj_cdk_api_mcp_server-0.43.0.dist-info → konokenj_cdk_api_mcp_server-0.45.0.dist-info}/RECORD +40 -27
- {konokenj_cdk_api_mcp_server-0.43.0.dist-info → konokenj_cdk_api_mcp_server-0.45.0.dist-info}/WHEEL +0 -0
- {konokenj_cdk_api_mcp_server-0.43.0.dist-info → konokenj_cdk_api_mcp_server-0.45.0.dist-info}/entry_points.txt +0 -0
- {konokenj_cdk_api_mcp_server-0.43.0.dist-info → konokenj_cdk_api_mcp_server-0.45.0.dist-info}/licenses/LICENSE.txt +0 -0
cdk_api_mcp_server/__about__.py
CHANGED
|
@@ -150,7 +150,7 @@ new iot.AccountAuditConfiguration(this, 'AuditConfiguration', {
|
|
|
150
150
|
checkConfiguration: {
|
|
151
151
|
deviceCertificateAgeCheck: true,
|
|
152
152
|
// The default value is 365 days
|
|
153
|
-
// Valid values range from 30 days (minimum) to
|
|
153
|
+
// Valid values range from 30 days (minimum) to 3650 days (10 years, maximum)
|
|
154
154
|
deviceCertificateAgeCheckDuration: Duration.days(365),
|
|
155
155
|
},
|
|
156
156
|
});
|
|
@@ -524,6 +524,14 @@ const arn = api.arnForExecuteApiV2('$connect', 'dev');
|
|
|
524
524
|
|
|
525
525
|
For a detailed explanation of this function, including usage and examples, please refer to the [Generating ARN for Execute API](#generating-arn-for-execute-api) section under HTTP API.
|
|
526
526
|
|
|
527
|
+
To disable schema validation, set `disableSchemaValidation` to true.
|
|
528
|
+
|
|
529
|
+
```ts
|
|
530
|
+
new apigwv2.WebSocketApi(this, 'api', {
|
|
531
|
+
disableSchemaValidation: true,
|
|
532
|
+
});
|
|
533
|
+
```
|
|
534
|
+
|
|
527
535
|
You can configure IP address type for the API endpoint using `ipAddressType` property.
|
|
528
536
|
Valid values are `IPV4` (default) and `DUAL_STACK`.
|
|
529
537
|
|
|
@@ -8,6 +8,10 @@ const stack = new cdk.Stack(app, 'aws-cdk-aws-apigatewayv2');
|
|
|
8
8
|
|
|
9
9
|
new apigw.WebSocketApi(stack, 'WebSocketApi');
|
|
10
10
|
|
|
11
|
+
new apigw.WebSocketApi(stack, 'WebSocketApiWithProps', {
|
|
12
|
+
disableSchemaValidation: true,
|
|
13
|
+
});
|
|
14
|
+
|
|
11
15
|
new IntegTest(app, 'web-socket-api', {
|
|
12
16
|
testCases: [stack],
|
|
13
17
|
});
|
|
@@ -532,6 +532,40 @@ const jobDefn = new batch.EcsJobDefinition(this, 'JobDefn', {
|
|
|
532
532
|
});
|
|
533
533
|
```
|
|
534
534
|
|
|
535
|
+
### Enable Execute Command (ECS Exec)
|
|
536
|
+
|
|
537
|
+
You can enable [ECS Exec](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-exec.html) for interactive debugging and troubleshooting by setting `enableExecuteCommand` to `true`.
|
|
538
|
+
When enabled, you'll be able to execute commands interactively in running containers.
|
|
539
|
+
|
|
540
|
+
```ts
|
|
541
|
+
const jobDefn = new batch.EcsJobDefinition(this, 'JobDefn', {
|
|
542
|
+
container: new batch.EcsEc2ContainerDefinition(this, 'Ec2Container', {
|
|
543
|
+
image: ecs.ContainerImage.fromRegistry('public.ecr.aws/amazonlinux/amazonlinux:latest'),
|
|
544
|
+
memory: cdk.Size.mebibytes(2048),
|
|
545
|
+
cpu: 256,
|
|
546
|
+
enableExecuteCommand: true, // Enable ECS Exec
|
|
547
|
+
}),
|
|
548
|
+
});
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
The same functionality is available for Fargate containers:
|
|
552
|
+
|
|
553
|
+
```ts
|
|
554
|
+
const jobDefn = new batch.EcsJobDefinition(this, 'JobDefn', {
|
|
555
|
+
container: new batch.EcsFargateContainerDefinition(this, 'FargateContainer', {
|
|
556
|
+
image: ecs.ContainerImage.fromRegistry('public.ecr.aws/amazonlinux/amazonlinux:latest'),
|
|
557
|
+
memory: cdk.Size.mebibytes(2048),
|
|
558
|
+
cpu: 256,
|
|
559
|
+
enableExecuteCommand: true, // Enable ECS Exec for Fargate
|
|
560
|
+
}),
|
|
561
|
+
});
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
When `enableExecuteCommand` is set to `true`:
|
|
565
|
+
|
|
566
|
+
- If no `jobRole` is provided, a new IAM role will be automatically created with the required SSM permissions
|
|
567
|
+
- If a `jobRole` is already provided, the necessary SSM permissions will be added to the existing role
|
|
568
|
+
|
|
535
569
|
### Secrets
|
|
536
570
|
|
|
537
571
|
You can expose SecretsManager Secret ARNs or SSM Parameters to your container as environment variables.
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-batch/integ.ecs-exec-batch-job.ts
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import * as batch from 'aws-cdk-lib/aws-batch';
|
|
2
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
3
|
+
import * as ecs from 'aws-cdk-lib/aws-ecs';
|
|
4
|
+
import * as cdk from 'aws-cdk-lib';
|
|
5
|
+
import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests-alpha';
|
|
6
|
+
|
|
7
|
+
class EcsExecBatchStack extends cdk.Stack {
|
|
8
|
+
public readonly ec2ComputeEnvironment: batch.ManagedEc2EcsComputeEnvironment;
|
|
9
|
+
public readonly fargateComputeEnvironment: batch.FargateComputeEnvironment;
|
|
10
|
+
public readonly ec2JobQueue: batch.JobQueue;
|
|
11
|
+
public readonly fargateJobQueue: batch.JobQueue;
|
|
12
|
+
public readonly ec2JobDefinition: batch.EcsJobDefinition;
|
|
13
|
+
public readonly fargateJobDefinition: batch.EcsJobDefinition;
|
|
14
|
+
|
|
15
|
+
constructor(scope: cdk.App, id: string, props: cdk.StackProps = {}) {
|
|
16
|
+
super(scope, id, props);
|
|
17
|
+
|
|
18
|
+
const vpc = new ec2.Vpc(this, 'Vpc', {
|
|
19
|
+
maxAzs: 2,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
this.ec2ComputeEnvironment = new batch.ManagedEc2EcsComputeEnvironment(this, 'ComputeEnv', {
|
|
23
|
+
vpc,
|
|
24
|
+
instanceTypes: [ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE)],
|
|
25
|
+
minvCpus: 0,
|
|
26
|
+
maxvCpus: 256,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
this.ec2JobQueue = new batch.JobQueue(this, 'JobQueue', {
|
|
30
|
+
computeEnvironments: [
|
|
31
|
+
{
|
|
32
|
+
order: 1,
|
|
33
|
+
computeEnvironment: this.ec2ComputeEnvironment,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
this.ec2JobDefinition = new batch.EcsJobDefinition(this, 'EcsExecEc2JobDefinition', {
|
|
39
|
+
jobDefinitionName: 'EcsExecEc2TestJob',
|
|
40
|
+
container: new batch.EcsEc2ContainerDefinition(this, 'Ec2Container', {
|
|
41
|
+
image: ecs.ContainerImage.fromRegistry('public.ecr.aws/amazonlinux/amazonlinux:latest'),
|
|
42
|
+
cpu: 2,
|
|
43
|
+
memory: cdk.Size.mebibytes(2048),
|
|
44
|
+
enableExecuteCommand: true,
|
|
45
|
+
command: ['sh', '-c', 'echo "Job started with ECS Exec enabled"; sleep 300'], // Keep container running
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
this.fargateJobDefinition = new batch.EcsJobDefinition(this, 'EcsExecFargateJobDefinition', {
|
|
50
|
+
container: new batch.EcsFargateContainerDefinition(this, 'FargateContainer', {
|
|
51
|
+
image: ecs.ContainerImage.fromRegistry('public.ecr.aws/amazonlinux/amazonlinux:latest'),
|
|
52
|
+
cpu: 0.25,
|
|
53
|
+
memory: cdk.Size.gibibytes(1),
|
|
54
|
+
enableExecuteCommand: true, // Enable ECS Exec
|
|
55
|
+
command: ['sh', '-c', 'echo "Fargate Job started with ECS Exec enabled"; sleep 300'], // Keep container running
|
|
56
|
+
}),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Create Fargate compute environment
|
|
60
|
+
this.fargateComputeEnvironment = new batch.FargateComputeEnvironment(this, 'FargateComputeEnv', {
|
|
61
|
+
vpc,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
this.fargateJobQueue = new batch.JobQueue(this, 'FargateJobQueue', {
|
|
65
|
+
computeEnvironments: [
|
|
66
|
+
{
|
|
67
|
+
order: 1,
|
|
68
|
+
computeEnvironment: this.fargateComputeEnvironment,
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const app = new cdk.App();
|
|
76
|
+
const stack = new EcsExecBatchStack(app, 'EcsExecBatchStack');
|
|
77
|
+
|
|
78
|
+
const integ = new IntegTest(app, 'EcsExecBatchTest', {
|
|
79
|
+
testCases: [stack],
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Helper function to test ECS Exec for a job
|
|
83
|
+
function testEcsExecForJob(
|
|
84
|
+
jobName: string,
|
|
85
|
+
jobQueue: batch.JobQueue,
|
|
86
|
+
jobDefinition: batch.EcsJobDefinition,
|
|
87
|
+
computeEnvironment: batch.IManagedComputeEnvironment,
|
|
88
|
+
) {
|
|
89
|
+
// Get cluster ARN from compute environment
|
|
90
|
+
const describeComputeEnv = integ.assertions.awsApiCall('Batch', 'describeComputeEnvironments', {
|
|
91
|
+
computeEnvironments: [computeEnvironment.computeEnvironmentArn],
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const clusterArn = describeComputeEnv.getAttString('computeEnvironments.0.ecsClusterArn');
|
|
95
|
+
|
|
96
|
+
// Submit the job
|
|
97
|
+
const submitJobResult = describeComputeEnv.next(
|
|
98
|
+
integ.assertions.awsApiCall('Batch', 'submitJob', {
|
|
99
|
+
jobName,
|
|
100
|
+
jobQueue: jobQueue.jobQueueArn,
|
|
101
|
+
jobDefinition: jobDefinition.jobDefinitionArn,
|
|
102
|
+
}),
|
|
103
|
+
).waitForAssertions();
|
|
104
|
+
|
|
105
|
+
// Get the job ID from the submit response
|
|
106
|
+
const jobId = submitJobResult.getAttString('jobId');
|
|
107
|
+
|
|
108
|
+
// Wait for job to reach RUNNING state and have a task ARN
|
|
109
|
+
const waitForJobRunning = integ.assertions.awsApiCall('Batch', 'describeJobs', {
|
|
110
|
+
jobs: [jobId],
|
|
111
|
+
}).assertAtPath('jobs.0.status', ExpectedResult.stringLikeRegexp('RUNNING'))
|
|
112
|
+
.waitForAssertions({
|
|
113
|
+
totalTimeout: cdk.Duration.minutes(10),
|
|
114
|
+
interval: cdk.Duration.seconds(30),
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const taskArn = waitForJobRunning.getAttString('jobs.0.container.taskArn');
|
|
118
|
+
|
|
119
|
+
// Execute ECS command to verify ECS Exec is enabled
|
|
120
|
+
waitForJobRunning.next(
|
|
121
|
+
integ.assertions.awsApiCall('ECS', 'executeCommand', {
|
|
122
|
+
cluster: clusterArn,
|
|
123
|
+
task: taskArn,
|
|
124
|
+
container: 'default',
|
|
125
|
+
interactive: true,
|
|
126
|
+
command: '/bin/bash',
|
|
127
|
+
}).waitForAssertions({
|
|
128
|
+
totalTimeout: cdk.Duration.minutes(10),
|
|
129
|
+
interval: cdk.Duration.seconds(30),
|
|
130
|
+
}),
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Test EC2 job
|
|
135
|
+
testEcsExecForJob(
|
|
136
|
+
'test-ecs-exec-ec2-job',
|
|
137
|
+
stack.ec2JobQueue,
|
|
138
|
+
stack.ec2JobDefinition,
|
|
139
|
+
stack.ec2ComputeEnvironment,
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
// Test Fargate job
|
|
143
|
+
testEcsExecForJob(
|
|
144
|
+
'test-ecs-exec-fargate-job',
|
|
145
|
+
stack.fargateJobQueue,
|
|
146
|
+
stack.fargateJobDefinition,
|
|
147
|
+
stack.fargateComputeEnvironment,
|
|
148
|
+
);
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudfront-origins/README.md
CHANGED
|
@@ -577,6 +577,7 @@ const origin = new origins.LoadBalancerV2Origin(loadBalancer, {
|
|
|
577
577
|
connectionAttempts: 3,
|
|
578
578
|
connectionTimeout: Duration.seconds(5),
|
|
579
579
|
readTimeout: Duration.seconds(45),
|
|
580
|
+
responseCompletionTimeout: Duration.seconds(120),
|
|
580
581
|
keepaliveTimeout: Duration.seconds(45),
|
|
581
582
|
protocolPolicy: cloudfront.OriginProtocolPolicy.MATCH_VIEWER,
|
|
582
583
|
});
|
|
@@ -596,6 +597,22 @@ new cloudfront.Distribution(this, 'myDist', {
|
|
|
596
597
|
});
|
|
597
598
|
```
|
|
598
599
|
|
|
600
|
+
The origin can be customized with timeout settings to handle different response scenarios:
|
|
601
|
+
|
|
602
|
+
```ts
|
|
603
|
+
new cloudfront.Distribution(this, 'Distribution', {
|
|
604
|
+
defaultBehavior: {
|
|
605
|
+
origin: new origins.HttpOrigin('api.example.com', {
|
|
606
|
+
readTimeout: Duration.seconds(60),
|
|
607
|
+
responseCompletionTimeout: Duration.seconds(120),
|
|
608
|
+
keepaliveTimeout: Duration.seconds(45),
|
|
609
|
+
}),
|
|
610
|
+
},
|
|
611
|
+
});
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
The `responseCompletionTimeout` property specifies the time that a request from CloudFront to the origin can stay open and wait for a response. If the complete response isn't received from the origin by this time, CloudFront ends the connection. Valid values are 1-3600 seconds, and if set, the value must be equal to or greater than the `readTimeout` value.
|
|
615
|
+
|
|
599
616
|
See the documentation of `aws-cdk-lib/aws-cloudfront` for more information.
|
|
600
617
|
|
|
601
618
|
## VPC origins
|
|
@@ -801,6 +818,25 @@ new cloudfront.Distribution(this, 'Distribution', {
|
|
|
801
818
|
});
|
|
802
819
|
```
|
|
803
820
|
|
|
821
|
+
You can also configure timeout settings for Lambda Function URL origins:
|
|
822
|
+
|
|
823
|
+
```ts
|
|
824
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
825
|
+
|
|
826
|
+
declare const fn: lambda.Function;
|
|
827
|
+
const fnUrl = fn.addFunctionUrl({ authType: lambda.FunctionUrlAuthType.NONE });
|
|
828
|
+
|
|
829
|
+
new cloudfront.Distribution(this, 'Distribution', {
|
|
830
|
+
defaultBehavior: {
|
|
831
|
+
origin: new origins.FunctionUrlOrigin(fnUrl, {
|
|
832
|
+
readTimeout: Duration.seconds(30),
|
|
833
|
+
responseCompletionTimeout: Duration.seconds(90),
|
|
834
|
+
keepaliveTimeout: Duration.seconds(45),
|
|
835
|
+
}),
|
|
836
|
+
},
|
|
837
|
+
});
|
|
838
|
+
```
|
|
839
|
+
|
|
804
840
|
### Lambda Function URL with Origin Access Control (OAC)
|
|
805
841
|
You can configure the Lambda Function URL with Origin Access Control (OAC) for enhanced security. When using OAC with Signing SIGV4_ALWAYS, it is recommended to set the Lambda Function URL authType to AWS_IAM to ensure proper authorization.
|
|
806
842
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
|
|
2
|
+
import * as origins from 'aws-cdk-lib/aws-cloudfront-origins';
|
|
3
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
4
|
+
import * as cdk from 'aws-cdk-lib';
|
|
5
|
+
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
6
|
+
|
|
7
|
+
const app = new cdk.App();
|
|
8
|
+
const stack = new cdk.Stack(app, 'integ-cloudfront-response-completion-timeout');
|
|
9
|
+
|
|
10
|
+
const httpOrigin = new origins.HttpOrigin('example.com', {
|
|
11
|
+
responseCompletionTimeout: cdk.Duration.seconds(120),
|
|
12
|
+
readTimeout: cdk.Duration.seconds(60),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const fn = new lambda.Function(stack, 'Function', {
|
|
16
|
+
runtime: lambda.Runtime.NODEJS_18_X,
|
|
17
|
+
handler: 'index.handler',
|
|
18
|
+
code: lambda.Code.fromInline('exports.handler = async () => ({ statusCode: 200, body: "Hello from Lambda!" });'),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const fnUrl = fn.addFunctionUrl({
|
|
22
|
+
authType: lambda.FunctionUrlAuthType.NONE,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const functionUrlOrigin = new origins.FunctionUrlOrigin(fnUrl, {
|
|
26
|
+
responseCompletionTimeout: cdk.Duration.seconds(90),
|
|
27
|
+
readTimeout: cdk.Duration.seconds(30),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const httpOriginNoReadTimeout = new origins.HttpOrigin('api.example.com', {
|
|
31
|
+
responseCompletionTimeout: cdk.Duration.seconds(300),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
new cloudfront.Distribution(stack, 'Distribution', {
|
|
35
|
+
defaultBehavior: {
|
|
36
|
+
origin: httpOrigin,
|
|
37
|
+
},
|
|
38
|
+
additionalBehaviors: {
|
|
39
|
+
'/api/*': {
|
|
40
|
+
origin: functionUrlOrigin,
|
|
41
|
+
},
|
|
42
|
+
'/files/*': {
|
|
43
|
+
origin: httpOriginNoReadTimeout,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
new IntegTest(app, 'CloudFrontResponseCompletionTimeoutTest', {
|
|
49
|
+
testCases: [stack],
|
|
50
|
+
});
|
|
@@ -376,6 +376,7 @@ can use the `environment` property to customize the build environment:
|
|
|
376
376
|
details on how to define build images.
|
|
377
377
|
* `certificate` defines the location of a PEM encoded certificate to import.
|
|
378
378
|
* `computeType` defines the instance type used for the build.
|
|
379
|
+
* `dockerServer` defines the docker server used for the build.
|
|
379
380
|
* `privileged` can be set to `true` to allow privileged access.
|
|
380
381
|
* `environmentVariables` can be set at this level (and also at the project
|
|
381
382
|
level).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { App, Stack } from 'aws-cdk-lib';
|
|
2
|
+
import { Project, BuildSpec, DockerServerComputeType, Source, ComputeType } from 'aws-cdk-lib/aws-codebuild';
|
|
3
|
+
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
4
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
5
|
+
|
|
6
|
+
const app = new App();
|
|
7
|
+
const stack = new Stack(app, 'codebuild-project-docker-server');
|
|
8
|
+
|
|
9
|
+
const vpc = new ec2.Vpc(stack, 'Vpc', { restrictDefaultSecurityGroup: false });
|
|
10
|
+
const sg = new ec2.SecurityGroup(stack, 'SecurityGroup', { vpc });
|
|
11
|
+
|
|
12
|
+
const project = new Project(stack, 'MyProject', {
|
|
13
|
+
source: Source.gitHub({
|
|
14
|
+
owner: 'dockersamples',
|
|
15
|
+
repo: 'helloworld-demo-python',
|
|
16
|
+
}),
|
|
17
|
+
buildSpec: BuildSpec.fromObject({
|
|
18
|
+
version: '0.2',
|
|
19
|
+
phases: {
|
|
20
|
+
build: {
|
|
21
|
+
commands: [
|
|
22
|
+
'cd sample',
|
|
23
|
+
'docker buildx build .',
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
}),
|
|
28
|
+
environment: {
|
|
29
|
+
computeType: ComputeType.SMALL,
|
|
30
|
+
dockerServer: {
|
|
31
|
+
computeType: DockerServerComputeType.SMALL,
|
|
32
|
+
securityGroups: [sg],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const integ = new IntegTest(app, 'codebuild-project-docker-server-integ', {
|
|
38
|
+
testCases: [stack],
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Execute the `startBuild` API to confirm that the build can be done correctly.
|
|
42
|
+
integ.assertions.awsApiCall('CodeBuild', 'startBuild', {
|
|
43
|
+
projectName: project.projectName,
|
|
44
|
+
}).waitForAssertions();
|
|
@@ -2,11 +2,13 @@ import * as path from 'path';
|
|
|
2
2
|
import * as codepipeline from 'aws-cdk-lib/aws-codepipeline';
|
|
3
3
|
import * as elasticbeanstalk from 'aws-cdk-lib/aws-elasticbeanstalk';
|
|
4
4
|
import * as iam from 'aws-cdk-lib/aws-iam';
|
|
5
|
+
import { IManagedPolicy, ManagedPolicyReference } from 'aws-cdk-lib/aws-iam';
|
|
5
6
|
import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
6
7
|
import * as deploy from 'aws-cdk-lib/aws-s3-deployment';
|
|
7
|
-
import { App, Fn, RemovalPolicy, Stack } from 'aws-cdk-lib';
|
|
8
|
+
import { App, Fn, RemovalPolicy, Stack, UnscopedValidationError } from 'aws-cdk-lib';
|
|
8
9
|
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
9
10
|
import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions';
|
|
11
|
+
import { Node } from 'constructs';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* To validate that the deployment actually succeeds, perform the following actions:
|
|
@@ -43,16 +45,26 @@ const artifact = new deploy.BucketDeployment(stack, 'DeployApp', {
|
|
|
43
45
|
extract: false,
|
|
44
46
|
});
|
|
45
47
|
|
|
48
|
+
function makePolicy(arn: string): IManagedPolicy {
|
|
49
|
+
return {
|
|
50
|
+
managedPolicyArn: arn,
|
|
51
|
+
get managedPolicyRef(): ManagedPolicyReference {
|
|
52
|
+
return {
|
|
53
|
+
policyArn: this.managedPolicyArn,
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
get node(): Node {
|
|
57
|
+
throw new UnscopedValidationError('The result of fromAwsManagedPolicyName can not be used in this API');
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
46
62
|
const serviceRole = new iam.Role(stack, 'service-role', {
|
|
47
63
|
roleName: 'codepipeline-elasticbeanstalk-action-test-serivce-role',
|
|
48
64
|
assumedBy: new iam.ServicePrincipal('elasticbeanstalk.amazonaws.com'),
|
|
49
65
|
managedPolicies: [
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
managedPolicyArn: 'arn:aws:iam::aws:policy/AWSElasticBeanstalkManagedUpdatesCustomerRolePolicy',
|
|
55
|
-
},
|
|
66
|
+
makePolicy('arn:aws:iam::aws:policy/service-role/AWSElasticBeanstalkEnhancedHealth'),
|
|
67
|
+
makePolicy('arn:aws:iam::aws:policy/AWSElasticBeanstalkManagedUpdatesCustomerRolePolicy'),
|
|
56
68
|
],
|
|
57
69
|
});
|
|
58
70
|
|
|
@@ -60,15 +72,9 @@ const instanceProfileRole = new iam.Role(stack, 'instance-profile-role', {
|
|
|
60
72
|
roleName: 'codepipeline-elasticbeanstalk-action-test-instance-profile-role',
|
|
61
73
|
assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'),
|
|
62
74
|
managedPolicies: [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
managedPolicyArn: 'arn:aws:iam::aws:policy/AWSElasticBeanstalkMulticontainerDocker',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
managedPolicyArn: 'arn:aws:iam::aws:policy/AWSElasticBeanstalkWorkerTier',
|
|
71
|
-
},
|
|
75
|
+
makePolicy('arn:aws:iam::aws:policy/AWSElasticBeanstalkWebTier'),
|
|
76
|
+
makePolicy('arn:aws:iam::aws:policy/AWSElasticBeanstalkMulticontainerDocker'),
|
|
77
|
+
makePolicy('arn:aws:iam::aws:policy/AWSElasticBeanstalkWorkerTier'),
|
|
72
78
|
],
|
|
73
79
|
});
|
|
74
80
|
|
|
@@ -163,6 +163,10 @@ This will instruct the toolkit to add the tarball as a file asset. During deploy
|
|
|
163
163
|
from `local-image.tar`, push it to an Amazon ECR repository and wire the name of the repository as CloudFormation parameters
|
|
164
164
|
to your stack.
|
|
165
165
|
|
|
166
|
+
Similar to `DockerImageAsset`, you can set the `CDK_DOCKER` environment variable to provide a custom Docker executable
|
|
167
|
+
command or path. This may be needed when building in environments where the standard docker cannot be executed or when
|
|
168
|
+
using alternative container runtimes like Finch.
|
|
169
|
+
|
|
166
170
|
## Publishing images to ECR repositories
|
|
167
171
|
|
|
168
172
|
`DockerImageAsset` is designed for seamless build & consumption of image assets by CDK code deployed to multiple environments
|
|
@@ -1591,6 +1591,8 @@ it in the constructor. Then add the Capacity Provider to the cluster. Finally,
|
|
|
1591
1591
|
you can refer to the Provider by its name in your service's or task's Capacity
|
|
1592
1592
|
Provider strategy.
|
|
1593
1593
|
|
|
1594
|
+
> **Note**: Cross-stack capacity provider registration is not supported. The ECS cluster and its capacity providers must be created in the same stack to avoid circular dependency issues.
|
|
1595
|
+
|
|
1594
1596
|
By default, Auto Scaling Group Capacity Providers will manage the scale-in and
|
|
1595
1597
|
scale-out behavior of the auto scaling group based on the load your tasks put on
|
|
1596
1598
|
the cluster, this is called [Managed Scaling](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/asg-capacity-providers.html#asg-capacity-providers-managed-scaling). If you'd
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/README.md
CHANGED
|
@@ -746,6 +746,27 @@ const ipv6NetworkTargetGroup = new elbv2.NetworkTargetGroup(this, 'Ipv6NetworkTa
|
|
|
746
746
|
});
|
|
747
747
|
```
|
|
748
748
|
|
|
749
|
+
### Target Group level health setting for Application Load Balancers and Network Load Balancers
|
|
750
|
+
|
|
751
|
+
You can set target group health setting at target group level by setting `targetGroupHealth` property.
|
|
752
|
+
|
|
753
|
+
For more information, see [How Elastic Load Balancing works](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html#target-group-attributes).
|
|
754
|
+
|
|
755
|
+
```ts
|
|
756
|
+
declare const vpc: ec2.Vpc;
|
|
757
|
+
|
|
758
|
+
const targetGroup = new elbv2.ApplicationTargetGroup(this, 'TargetGroup', {
|
|
759
|
+
vpc,
|
|
760
|
+
port: 80,
|
|
761
|
+
targetGroupHealth: {
|
|
762
|
+
dnsMinimumHealthyTargetCount: 3,
|
|
763
|
+
dnsMinimumHealthyTargetPercentage: 70,
|
|
764
|
+
routingMinimumHealthyTargetCount: 2,
|
|
765
|
+
routingMinimumHealthyTargetPercentage: 50,
|
|
766
|
+
},
|
|
767
|
+
});
|
|
768
|
+
```
|
|
769
|
+
|
|
749
770
|
## Using Lambda Targets
|
|
750
771
|
|
|
751
772
|
To use a Lambda Function as a target, use the integration class in the
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ExpectedResult, IntegTest, Match } from '@aws-cdk/integ-tests-alpha';
|
|
2
|
+
import { Stack, aws_ec2 as ec2, aws_elasticloadbalancingv2 as elbv2, App } from 'aws-cdk-lib';
|
|
3
|
+
|
|
4
|
+
const app = new App();
|
|
5
|
+
const stack = new Stack(app, 'alb-target-group-attributes');
|
|
6
|
+
|
|
7
|
+
const vpc = new ec2.Vpc(stack, 'Stack');
|
|
8
|
+
|
|
9
|
+
const targetGroup = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', {
|
|
10
|
+
vpc,
|
|
11
|
+
port: 80,
|
|
12
|
+
targetGroupHealth: {
|
|
13
|
+
dnsMinimumHealthyTargetCount: 3,
|
|
14
|
+
dnsMinimumHealthyTargetPercentage: 70,
|
|
15
|
+
routingMinimumHealthyTargetCount: 2,
|
|
16
|
+
routingMinimumHealthyTargetPercentage: 50,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const integTest = new IntegTest(app, 'alb-target-group-attributes-test', {
|
|
21
|
+
testCases: [stack],
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
integTest.assertions.awsApiCall('elbv2', 'describeTargetGroupAttributes', {
|
|
25
|
+
TargetGroupArn: targetGroup.targetGroupArn,
|
|
26
|
+
}).expect(ExpectedResult.objectLike({
|
|
27
|
+
Attributes: Match.arrayWith([
|
|
28
|
+
{
|
|
29
|
+
Key: 'target_group_health.unhealthy_state_routing.minimum_healthy_targets.percentage',
|
|
30
|
+
Value: '50',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
Key: 'target_group_health.dns_failover.minimum_healthy_targets.percentage',
|
|
34
|
+
Value: '70',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
Key: 'target_group_health.unhealthy_state_routing.minimum_healthy_targets.count',
|
|
38
|
+
Value: '2',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
Key: 'target_group_health.dns_failover.minimum_healthy_targets.count',
|
|
42
|
+
Value: '3',
|
|
43
|
+
},
|
|
44
|
+
]),
|
|
45
|
+
}));
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ExpectedResult, IntegTest, Match } from '@aws-cdk/integ-tests-alpha';
|
|
2
|
+
import { Stack, aws_ec2 as ec2, aws_elasticloadbalancingv2 as elbv2, App } from 'aws-cdk-lib';
|
|
3
|
+
|
|
4
|
+
const app = new App();
|
|
5
|
+
const stack = new Stack(app, 'nlb-target-group-attributes');
|
|
6
|
+
|
|
7
|
+
const vpc = new ec2.Vpc(stack, 'Stack');
|
|
8
|
+
|
|
9
|
+
const targetGroup = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', {
|
|
10
|
+
vpc,
|
|
11
|
+
port: 80,
|
|
12
|
+
targetGroupHealth: {
|
|
13
|
+
dnsMinimumHealthyTargetCount: 3,
|
|
14
|
+
dnsMinimumHealthyTargetPercentage: 70,
|
|
15
|
+
routingMinimumHealthyTargetCount: 2,
|
|
16
|
+
routingMinimumHealthyTargetPercentage: 50,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const integTest = new IntegTest(app, 'nlb-target-group-attributes-test', {
|
|
21
|
+
testCases: [stack],
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
integTest.assertions.awsApiCall('elbv2', 'describeTargetGroupAttributes', {
|
|
25
|
+
TargetGroupArn: targetGroup.targetGroupArn,
|
|
26
|
+
}).expect(ExpectedResult.objectLike({
|
|
27
|
+
Attributes: Match.arrayWith([
|
|
28
|
+
{
|
|
29
|
+
Key: 'target_group_health.unhealthy_state_routing.minimum_healthy_targets.count',
|
|
30
|
+
Value: '2',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
Key: 'target_group_health.unhealthy_state_routing.minimum_healthy_targets.percentage',
|
|
34
|
+
Value: '50',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
Key: 'target_group_health.dns_failover.minimum_healthy_targets.count',
|
|
38
|
+
Value: '3',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
Key: 'target_group_health.dns_failover.minimum_healthy_targets.percentage',
|
|
42
|
+
Value: '70',
|
|
43
|
+
},
|
|
44
|
+
]),
|
|
45
|
+
}));
|
|
@@ -356,4 +356,21 @@ const archive = new Archive(stack, 'Archive', {
|
|
|
356
356
|
```
|
|
357
357
|
|
|
358
358
|
To enable archives or schema discovery on an event bus, customers has the choice of using either an AWS owned key or a customer managed key.
|
|
359
|
-
For more information, see [KMS key options for event bus encryption](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-encryption-at-rest-key-options.html).
|
|
359
|
+
For more information, see [KMS key options for event bus encryption](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-encryption-at-rest-key-options.html).
|
|
360
|
+
|
|
361
|
+
## Configuring logging
|
|
362
|
+
|
|
363
|
+
To configure logging for an Event Bus, leverage the LogConfig property. It allows different level of logging (NONE, INFO, TRACE, ERROR) and wether to include details or not.
|
|
364
|
+
|
|
365
|
+
```ts
|
|
366
|
+
import { EventBus, IncludeDetail, Level } from 'aws-cdk-lib/aws-events';
|
|
367
|
+
|
|
368
|
+
const bus = new EventBus(this, 'Bus', {
|
|
369
|
+
logConfig: {
|
|
370
|
+
includeDetail: IncludeDetail.FULL,
|
|
371
|
+
level: Level.TRACE,
|
|
372
|
+
},
|
|
373
|
+
});
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
See more [Specifying event bus log level](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-bus-logs.html#eb-event-bus-logs-level)
|
|
@@ -2,21 +2,31 @@ import * as iam from 'aws-cdk-lib/aws-iam';
|
|
|
2
2
|
import * as sqs from 'aws-cdk-lib/aws-sqs';
|
|
3
3
|
import { App, Stack } from 'aws-cdk-lib';
|
|
4
4
|
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
5
|
-
import { EventBus } from 'aws-cdk-lib/aws-events';
|
|
5
|
+
import { EventBus, IncludeDetail, Level } from 'aws-cdk-lib/aws-events';
|
|
6
6
|
|
|
7
7
|
const app = new App();
|
|
8
8
|
const stack = new Stack(app, 'Stack');
|
|
9
9
|
|
|
10
10
|
const dlq = new sqs.Queue(stack, 'DLQ');
|
|
11
11
|
|
|
12
|
+
const eventBusRole = new iam.Role(stack, 'EventBusRole', {
|
|
13
|
+
assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'),
|
|
14
|
+
description: 'Role for accessing EventBus',
|
|
15
|
+
roleName: 'EventBusAccessRole',
|
|
16
|
+
});
|
|
17
|
+
|
|
12
18
|
const bus = new EventBus(stack, 'Bus', {
|
|
13
19
|
deadLetterQueue: dlq,
|
|
14
20
|
description: 'myEventBus',
|
|
21
|
+
logConfig: {
|
|
22
|
+
includeDetail: IncludeDetail.FULL,
|
|
23
|
+
level: Level.ERROR,
|
|
24
|
+
},
|
|
15
25
|
});
|
|
16
26
|
|
|
17
27
|
bus.addToResourcePolicy(new iam.PolicyStatement({
|
|
18
28
|
effect: iam.Effect.ALLOW,
|
|
19
|
-
principals: [
|
|
29
|
+
principals: [eventBusRole],
|
|
20
30
|
actions: ['events:PutEvents'],
|
|
21
31
|
sid: 'Statement1',
|
|
22
32
|
resources: [bus.eventBusArn],
|
|
@@ -24,7 +34,7 @@ bus.addToResourcePolicy(new iam.PolicyStatement({
|
|
|
24
34
|
|
|
25
35
|
bus.addToResourcePolicy(new iam.PolicyStatement({
|
|
26
36
|
effect: iam.Effect.ALLOW,
|
|
27
|
-
principals: [
|
|
37
|
+
principals: [eventBusRole],
|
|
28
38
|
actions: ['events:PutRule'],
|
|
29
39
|
sid: 'Statement2',
|
|
30
40
|
resources: [bus.eventBusArn],
|