konokenj.cdk-api-mcp-server 0.48.0__py3-none-any.whl → 0.50.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-amplify-alpha/README.md +12 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-bedrock-agentcore-alpha/README.md +796 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-eks-v2-alpha/README.md +116 -29
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-msk-alpha/README.md +8 -8
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/mixins-preview/README.md +16 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigateway/integ.api-with-authorizer-and-proxy.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigateway/integ.lambda-api.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-authorizers/integ.iam.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-authorizers/integ.lambda.ts +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-authorizers/integ.user-pool.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.add-subroute-integration.ts +7 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.http-proxy.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.lambda-proxy.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.lambda.ts +4 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-appsync/integ.graphql-lambda-permission.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-appsync/integ.js-resolver.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-batch/README.md +15 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-batch/integ.managed-compute-environment-default-instance-class.ts +20 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudformation/integ.core-custom-resources-node-18.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudformation/integ.core-custom-resources-service-timeout.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudfront-origins/README.md +33 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudfront-origins/integ.function-url-origin-ip-address-type.ts +84 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudfront-origins/integ.origin-response-completion-timeout.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudtrail/integ.cloudtrail-data-events-only.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch/README.md +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch/integ.anomaly-detection-alarm.ts +44 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/README.md +15 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/integ.client-vpn-endpoint-disconnect-on-session-timeout.ts +65 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecr/README.md +40 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecr/integ.tag-mutability-exclusion.ts +30 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/README.md +3 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.managedinstances-capacity-provider.ts +5 -3
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.managedinstances-no-default-capacity-provider.ts +107 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs-patterns/integ.alb-fargate-service-public-private-switch.ts +45 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-eks/README.md +20 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-eks/integ.eks-cluster-removal-policy.ts +31 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/integ.alb-lambda-multi-value-headers.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/integ.alb.oidc.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2-actions/integ.cognito.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesis/README.md +42 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesis/integ.stream-shard-level-monitoring.ts +47 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/README.md +96 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/integ.record-format-conversion-schema.ts +154 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/integ.record-format-conversion.ts +178 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/README.md +9 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.binary-payload.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.logging-config.ts +8 -8
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.params-and-secrets.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.runtime-management.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.runtime.inlinecode.ts +0 -7
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda-nodejs/integ.dependencies-pnpm.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda-nodejs/integ.function-exclude-smithy-models.ts +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda-nodejs/integ.nodejs.build.images.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-logs/README.md +4 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-logs/integ.metricfilter-apply-on-transformed-logs.ts +29 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-logs/integ.subscriptionfilter.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-opensearchservice/integ.opensearch.min.ts +1 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.cluster-data-api-to-imported-cluster.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.cluster-data-api.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/README.md +12 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/integ.private-hosted-zone-from-attributes.ts +41 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-data.ts +4 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/README.md +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.call-aws-service-cross-region-lambda.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.invoke-json-path.ts +102 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/README.md +17 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/integ.canary-runtime-validation.ts +43 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/integ.canary.ts +2 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/custom-resources/integ.aws-custom-resource.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/custom-resources/integ.custom-resource-config-lambda-node-runtime.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/custom-resources/integ.invoke-function-payload.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +43 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cx-api/README.md +32 -1
- {konokenj_cdk_api_mcp_server-0.48.0.dist-info → konokenj_cdk_api_mcp_server-0.50.0.dist-info}/METADATA +2 -2
- {konokenj_cdk_api_mcp_server-0.48.0.dist-info → konokenj_cdk_api_mcp_server-0.50.0.dist-info}/RECORD +79 -63
- {konokenj_cdk_api_mcp_server-0.48.0.dist-info → konokenj_cdk_api_mcp_server-0.50.0.dist-info}/WHEEL +0 -0
- {konokenj_cdk_api_mcp_server-0.48.0.dist-info → konokenj_cdk_api_mcp_server-0.50.0.dist-info}/entry_points.txt +0 -0
- {konokenj_cdk_api_mcp_server-0.48.0.dist-info → konokenj_cdk_api_mcp_server-0.50.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -479,7 +479,7 @@ const metric = new cloudwatch.Metric({
|
|
|
479
479
|
namespace: 'AWS/EC2',
|
|
480
480
|
metricName: 'CPUUtilization',
|
|
481
481
|
statistic: 'Average',
|
|
482
|
-
period: Duration.
|
|
482
|
+
period: Duration.hours(1), // Alarm will use the metric's period
|
|
483
483
|
});
|
|
484
484
|
|
|
485
485
|
// Create an anomaly detection alarm
|
|
@@ -5,12 +5,19 @@ import { Metric, ComparisonOperator, AnomalyDetectionAlarm, Alarm } from 'aws-cd
|
|
|
5
5
|
const app = new App();
|
|
6
6
|
const stack = new Stack(app, 'AnomalyDetectionAlarmTestStack');
|
|
7
7
|
|
|
8
|
-
// Create the test metric
|
|
8
|
+
// Create the test metric. Period will default to 300 seconds.
|
|
9
9
|
const metric = new Metric({
|
|
10
10
|
namespace: 'AWS/EC2',
|
|
11
11
|
metricName: 'CPUUtilization',
|
|
12
12
|
statistic: 'Average',
|
|
13
|
-
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// Create test metric with custom period
|
|
16
|
+
const customPeriodMetric = new Metric({
|
|
17
|
+
namespace: 'AWS/EC2',
|
|
18
|
+
metricName: 'CPUUtilization',
|
|
19
|
+
statistic: 'Average',
|
|
20
|
+
period: Duration.days(1),
|
|
14
21
|
});
|
|
15
22
|
|
|
16
23
|
// Create an anomaly detection alarm with default operator
|
|
@@ -40,6 +47,14 @@ const descriptiveAlarm = Metric.anomalyDetectionFor({
|
|
|
40
47
|
comparisonOperator: ComparisonOperator.GREATER_THAN_UPPER_THRESHOLD,
|
|
41
48
|
});
|
|
42
49
|
|
|
50
|
+
// Create an anomaly detection alarm with custom period
|
|
51
|
+
const customPeriodAlarm = new AnomalyDetectionAlarm(stack, 'CustomPeriodAnomalyAlarm', {
|
|
52
|
+
metric: customPeriodMetric,
|
|
53
|
+
stdDevs: 2,
|
|
54
|
+
evaluationPeriods: 1,
|
|
55
|
+
comparisonOperator: ComparisonOperator.LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD,
|
|
56
|
+
});
|
|
57
|
+
|
|
43
58
|
// Create the integration test
|
|
44
59
|
const integ = new IntegTest(app, 'AnomalyDetectionAlarmIntegTest', {
|
|
45
60
|
testCases: [stack],
|
|
@@ -122,3 +137,30 @@ integ.assertions
|
|
|
122
137
|
}),
|
|
123
138
|
]),
|
|
124
139
|
}));
|
|
140
|
+
|
|
141
|
+
integ.assertions
|
|
142
|
+
.awsApiCall('CloudWatch', 'describeAlarms', {
|
|
143
|
+
AlarmNames: [customPeriodAlarm.alarmName],
|
|
144
|
+
})
|
|
145
|
+
.expect(ExpectedResult.objectLike({
|
|
146
|
+
MetricAlarms: Match.arrayWith([
|
|
147
|
+
Match.objectLike({
|
|
148
|
+
ComparisonOperator: 'LessThanLowerOrGreaterThanUpperThreshold',
|
|
149
|
+
EvaluationPeriods: 1,
|
|
150
|
+
ThresholdMetricId: 'expr_1',
|
|
151
|
+
Metrics: Match.arrayWith([
|
|
152
|
+
Match.objectLike({
|
|
153
|
+
Expression: 'ANOMALY_DETECTION_BAND(m0, 2)',
|
|
154
|
+
Id: 'expr_1',
|
|
155
|
+
ReturnData: true,
|
|
156
|
+
}),
|
|
157
|
+
Match.objectLike({
|
|
158
|
+
Id: 'm0',
|
|
159
|
+
MetricStat: Match.objectLike({
|
|
160
|
+
Period: 86400, // 1 day in seconds, orignal metric period got overriden
|
|
161
|
+
}),
|
|
162
|
+
}),
|
|
163
|
+
]),
|
|
164
|
+
}),
|
|
165
|
+
]),
|
|
166
|
+
}));
|
|
@@ -1306,6 +1306,21 @@ const endpoint = vpc.addClientVpnEndpoint('Endpoint', {
|
|
|
1306
1306
|
});
|
|
1307
1307
|
```
|
|
1308
1308
|
|
|
1309
|
+
To control whether clients are automatically disconnected when the maximum session duration is reached, use the `disconnectOnSessionTimeout` prop.
|
|
1310
|
+
By default (`true`), clients are disconnected and must manually reconnect.
|
|
1311
|
+
Set to `false` to allow automatic reconnection attempts:
|
|
1312
|
+
|
|
1313
|
+
```ts fixture=client-vpn
|
|
1314
|
+
const endpoint = vpc.addClientVpnEndpoint('Endpoint', {
|
|
1315
|
+
cidr: '10.100.0.0/16',
|
|
1316
|
+
serverCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/server-certificate-id',
|
|
1317
|
+
clientCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/client-certificate-id',
|
|
1318
|
+
disconnectOnSessionTimeout: false, // Allow automatic reconnection attempts
|
|
1319
|
+
});
|
|
1320
|
+
```
|
|
1321
|
+
|
|
1322
|
+
Detail information about maximum VPN session duration timeout can be found in the [AWS documentation](https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/cvpn-working-max-duration.html).
|
|
1323
|
+
|
|
1309
1324
|
## Instances
|
|
1310
1325
|
|
|
1311
1326
|
You can use the `Instance` class to start up a single EC2 instance. For production setups, we recommend
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { App, RemovalPolicy, Stack, StackProps, UnscopedValidationError } from 'aws-cdk-lib';
|
|
2
|
+
import * as acm from 'aws-cdk-lib/aws-certificatemanager';
|
|
3
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
4
|
+
import * as logs from 'aws-cdk-lib/aws-logs';
|
|
5
|
+
import * as route53 from 'aws-cdk-lib/aws-route53';
|
|
6
|
+
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
7
|
+
import { Construct } from 'constructs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* In order to test this you need to have a valid public hosted zone that you can use
|
|
11
|
+
* to validate the domain identity.
|
|
12
|
+
*/
|
|
13
|
+
const hostedZoneId = process.env.CDK_INTEG_HOSTED_ZONE_ID ?? process.env.HOSTED_ZONE_ID;
|
|
14
|
+
if (!hostedZoneId) throw new UnscopedValidationError('For this test you must provide your own HostedZoneId as an env var "HOSTED_ZONE_ID". See framework-integ/README.md for details.');
|
|
15
|
+
const hostedZoneName = process.env.CDK_INTEG_HOSTED_ZONE_NAME ?? process.env.HOSTED_ZONE_NAME;
|
|
16
|
+
if (!hostedZoneName) throw new UnscopedValidationError('For this test you must provide your own HostedZoneName as an env var "HOSTED_ZONE_NAME". See framework-integ/README.md for details.');
|
|
17
|
+
|
|
18
|
+
interface TestStackProps extends StackProps {
|
|
19
|
+
hostedZoneId: string;
|
|
20
|
+
hostedZoneName: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
class TestStack extends Stack {
|
|
24
|
+
constructor(scope: Construct, id: string, props: TestStackProps) {
|
|
25
|
+
super(scope, id, props);
|
|
26
|
+
|
|
27
|
+
const hostedZone = route53.PublicHostedZone.fromHostedZoneAttributes(this, 'HostedZone', {
|
|
28
|
+
hostedZoneId: props.hostedZoneId,
|
|
29
|
+
zoneName: props.hostedZoneName,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const serverCertificate = new acm.Certificate(this, 'Certificate', {
|
|
33
|
+
domainName: `server.${props.hostedZoneName}`,
|
|
34
|
+
validation: acm.CertificateValidation.fromDns(hostedZone),
|
|
35
|
+
});
|
|
36
|
+
const clientCertificate = new acm.Certificate(this, 'ClientCertificate', {
|
|
37
|
+
domainName: `client.${props.hostedZoneName}`,
|
|
38
|
+
validation: acm.CertificateValidation.fromDns(hostedZone),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2, natGateways: 0 });
|
|
42
|
+
|
|
43
|
+
const logGroup = new logs.LogGroup(this, 'LogGroup', {
|
|
44
|
+
removalPolicy: RemovalPolicy.DESTROY,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
vpc.addClientVpnEndpoint('Endpoint', {
|
|
48
|
+
cidr: '10.100.0.0/16',
|
|
49
|
+
serverCertificateArn: serverCertificate.certificateArn,
|
|
50
|
+
clientCertificateArn: clientCertificate.certificateArn,
|
|
51
|
+
logGroup,
|
|
52
|
+
disconnectOnSessionTimeout: false,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const app = new App();
|
|
58
|
+
new IntegTest(app, 'client-vpn-endpoint-integ', {
|
|
59
|
+
testCases: [
|
|
60
|
+
new TestStack(app, 'client-vpn-endpoint-stack', {
|
|
61
|
+
hostedZoneId,
|
|
62
|
+
hostedZoneName,
|
|
63
|
+
}),
|
|
64
|
+
],
|
|
65
|
+
});
|
|
@@ -121,12 +121,51 @@ By using these methods, you can grant specific operational permissions on the EC
|
|
|
121
121
|
|
|
122
122
|
### Image tag immutability
|
|
123
123
|
|
|
124
|
-
You can set tag immutability on images in
|
|
124
|
+
You can set tag immutability on images in your repository using the `imageTagMutability` construct prop.
|
|
125
125
|
|
|
126
126
|
```ts
|
|
127
127
|
new ecr.Repository(this, 'Repo', { imageTagMutability: ecr.TagMutability.IMMUTABLE });
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
+
#### Image tag mutability with exclusion filters
|
|
131
|
+
|
|
132
|
+
ECR supports more granular control over image tag mutability by allowing you to specify exclusion filters. This enables you to make your repository immutable while allowing specific tag patterns to remain mutable (or vice versa).
|
|
133
|
+
|
|
134
|
+
There are two new mutability options that work with exclusion filters:
|
|
135
|
+
|
|
136
|
+
- `MUTABLE_WITH_EXCLUSION`: Tags are mutable by default, except those matching the exclusion filters
|
|
137
|
+
- `IMMUTABLE_WITH_EXCLUSION`: Tags are immutable by default, except those matching the exclusion filters
|
|
138
|
+
|
|
139
|
+
Use `ImageTagMutabilityExclusionFilter.wildcard()` to create filters with wildcard patterns:
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
// Make all tags immutable except for those starting with 'dev-' or 'test-'
|
|
143
|
+
new ecr.Repository(this, 'Repo', {
|
|
144
|
+
imageTagMutability: ecr.TagMutability.IMMUTABLE_WITH_EXCLUSION,
|
|
145
|
+
imageTagMutabilityExclusionFilters: [
|
|
146
|
+
ecr.ImageTagMutabilityExclusionFilter.wildcard('dev-*'),
|
|
147
|
+
ecr.ImageTagMutabilityExclusionFilter.wildcard('test-*'),
|
|
148
|
+
],
|
|
149
|
+
});
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
// Make all tags mutable except for production releases
|
|
154
|
+
new ecr.Repository(this, 'Repo', {
|
|
155
|
+
imageTagMutability: ecr.TagMutability.MUTABLE_WITH_EXCLUSION,
|
|
156
|
+
imageTagMutabilityExclusionFilters: [
|
|
157
|
+
ecr.ImageTagMutabilityExclusionFilter.wildcard('prod-*'),
|
|
158
|
+
ecr.ImageTagMutabilityExclusionFilter.wildcard('release-v*'),
|
|
159
|
+
],
|
|
160
|
+
});
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
##### Exclusion filter pattern rules
|
|
164
|
+
|
|
165
|
+
- Patterns can contain alphanumeric characters, dots (.), underscores (_), hyphens (-), and asterisks (*) as wildcards
|
|
166
|
+
- Maximum pattern length is 128 characters
|
|
167
|
+
- You can specify up to 5 exclusion filters per repository
|
|
168
|
+
|
|
130
169
|
### Encryption
|
|
131
170
|
|
|
132
171
|
By default, Amazon ECR uses server-side encryption with Amazon S3-managed encryption keys which encrypts your data at rest using an AES-256 encryption algorithm. For more control over the encryption for your Amazon ECR repositories, you can use server-side encryption with KMS keys stored in AWS Key Management Service (AWS KMS). Read more about this feature in the [ECR Developer Guide](https://docs.aws.amazon.com/AmazonECR/latest/userguide/encryption-at-rest.html).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as cdk from 'aws-cdk-lib';
|
|
2
|
+
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
3
|
+
import * as ecr from 'aws-cdk-lib/aws-ecr';
|
|
4
|
+
|
|
5
|
+
const app = new cdk.App();
|
|
6
|
+
const stack = new cdk.Stack(app, 'aws-ecr-tag-mutability-exclusion-stack');
|
|
7
|
+
|
|
8
|
+
new ecr.Repository(stack, 'ImmutableRepoWithExclusions', {
|
|
9
|
+
imageTagMutability: ecr.TagMutability.IMMUTABLE_WITH_EXCLUSION,
|
|
10
|
+
imageTagMutabilityExclusionFilters: [
|
|
11
|
+
ecr.ImageTagMutabilityExclusionFilter.wildcard('dev-*'),
|
|
12
|
+
ecr.ImageTagMutabilityExclusionFilter.wildcard('test-*'),
|
|
13
|
+
],
|
|
14
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
15
|
+
emptyOnDelete: true,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
new ecr.Repository(stack, 'MutableRepoWithExclusions', {
|
|
19
|
+
imageTagMutability: ecr.TagMutability.MUTABLE_WITH_EXCLUSION,
|
|
20
|
+
imageTagMutabilityExclusionFilters: [
|
|
21
|
+
ecr.ImageTagMutabilityExclusionFilter.wildcard('prod-*'),
|
|
22
|
+
ecr.ImageTagMutabilityExclusionFilter.wildcard('release-v*'),
|
|
23
|
+
],
|
|
24
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
25
|
+
emptyOnDelete: true,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
new IntegTest(app, 'cdk-ecr-tag-mutability-exclusion-test', {
|
|
29
|
+
testCases: [stack],
|
|
30
|
+
});
|
|
@@ -1687,6 +1687,9 @@ const miCapacityProvider = new ecs.ManagedInstancesCapacityProvider(this, 'MICap
|
|
|
1687
1687
|
propagateTags: ecs.PropagateManagedInstancesTags.CAPACITY_PROVIDER,
|
|
1688
1688
|
});
|
|
1689
1689
|
|
|
1690
|
+
// Optionally configure security group rules using IConnectable interface
|
|
1691
|
+
miCapacityProvider.connections.allowFrom(ec2.Peer.ipv4(vpc.vpcCidrBlock), ec2.Port.tcp(80));
|
|
1692
|
+
|
|
1690
1693
|
// Add the capacity provider to the cluster
|
|
1691
1694
|
cluster.addManagedInstancesCapacityProvider(miCapacityProvider);
|
|
1692
1695
|
|
|
@@ -24,7 +24,7 @@ const infrastructureRole = new iam.Role(stack, 'InfrastructureRole', {
|
|
|
24
24
|
roleName: 'AmazonECSInfrastructureRoleForOmakase',
|
|
25
25
|
assumedBy: new iam.ServicePrincipal('ecs.amazonaws.com'),
|
|
26
26
|
managedPolicies: [
|
|
27
|
-
iam.ManagedPolicy.fromAwsManagedPolicyName('
|
|
27
|
+
iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonECSInfrastructureRolePolicyForManagedInstances'),
|
|
28
28
|
],
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -32,7 +32,7 @@ const instanceRole = new iam.Role(stack, 'InstanceRole', {
|
|
|
32
32
|
roleName: 'AmazonECSInstanceRoleForOmakase',
|
|
33
33
|
assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'),
|
|
34
34
|
managedPolicies: [
|
|
35
|
-
iam.ManagedPolicy.fromAwsManagedPolicyName('
|
|
35
|
+
iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonECSInstanceRolePolicyForManagedInstances'),
|
|
36
36
|
],
|
|
37
37
|
});
|
|
38
38
|
|
|
@@ -63,6 +63,9 @@ const miCapacityProvider = new ecs.ManagedInstancesCapacityProvider(stack, 'Mana
|
|
|
63
63
|
},
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
+
// Configure security group rules using IConnectable interface
|
|
67
|
+
miCapacityProvider.connections.allowFrom(ec2.Peer.ipv4(vpc.vpcCidrBlock), ec2.Port.tcp(80));
|
|
68
|
+
|
|
66
69
|
// Add FMI capacity provider to cluster
|
|
67
70
|
cluster.addManagedInstancesCapacityProvider(miCapacityProvider);
|
|
68
71
|
cluster.addDefaultCapacityProviderStrategy([
|
|
@@ -106,7 +109,6 @@ new ecs.FargateService(stack, 'ManagedInstancesService', {
|
|
|
106
109
|
|
|
107
110
|
new integ.IntegTest(app, 'ManagedInstancesCapacityProviders', {
|
|
108
111
|
testCases: [stack],
|
|
109
|
-
regions: ['us-west-2'],
|
|
110
112
|
});
|
|
111
113
|
|
|
112
114
|
app.synth();
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
2
|
+
import * as iam from 'aws-cdk-lib/aws-iam';
|
|
3
|
+
import * as cdk from 'aws-cdk-lib';
|
|
4
|
+
import * as ecs from 'aws-cdk-lib/aws-ecs';
|
|
5
|
+
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
6
|
+
|
|
7
|
+
const app = new cdk.App({
|
|
8
|
+
postCliContext: {
|
|
9
|
+
'@aws-cdk/aws-ecs:removeDefaultDeploymentAlarm': true,
|
|
10
|
+
'@aws-cdk/aws-ecs:enableImdsBlockingDeprecatedFeature': false,
|
|
11
|
+
'@aws-cdk/aws-ecs:disableEcsImdsBlocking': false,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
const stack = new cdk.Stack(app, 'integ-managedinstances-no-default-capacity-provider');
|
|
15
|
+
|
|
16
|
+
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2, restrictDefaultSecurityGroup: false });
|
|
17
|
+
const cluster = new ecs.Cluster(stack, 'ManagedInstancesCluster', {
|
|
18
|
+
vpc,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Create IAM roles required for FMI following Omakase specifications
|
|
22
|
+
const infrastructureRole = new iam.Role(stack, 'InfrastructureRole', {
|
|
23
|
+
roleName: 'InfrastructureRole',
|
|
24
|
+
assumedBy: new iam.ServicePrincipal('ecs.amazonaws.com'),
|
|
25
|
+
managedPolicies: [
|
|
26
|
+
iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonECSInfrastructureRolePolicyForManagedInstances'),
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const instanceRole = new iam.Role(stack, 'InstanceRole', {
|
|
31
|
+
roleName: 'InstanceRole',
|
|
32
|
+
assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'),
|
|
33
|
+
managedPolicies: [
|
|
34
|
+
iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonECSInstanceRolePolicyForManagedInstances'),
|
|
35
|
+
],
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
infrastructureRole.grantPassRole(instanceRole);
|
|
39
|
+
|
|
40
|
+
const instanceProfile = new iam.InstanceProfile(stack, 'InstanceProfile', {
|
|
41
|
+
instanceProfileName: 'InstanceProfile',
|
|
42
|
+
role: instanceRole,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Create a security group for FMI instances
|
|
46
|
+
const fmiSecurityGroup = new ec2.SecurityGroup(stack, 'ManagedInstancesSecurityGroup', {
|
|
47
|
+
vpc,
|
|
48
|
+
description: 'Security group for ManagedInstances capacity provider instances',
|
|
49
|
+
allowAllOutbound: true,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Create MI Capacity Provider
|
|
53
|
+
const miCapacityProvider = new ecs.ManagedInstancesCapacityProvider(stack, 'ManagedInstancesCapacityProvider', {
|
|
54
|
+
infrastructureRole: infrastructureRole,
|
|
55
|
+
ec2InstanceProfile: instanceProfile,
|
|
56
|
+
subnets: vpc.privateSubnets,
|
|
57
|
+
securityGroups: [fmiSecurityGroup],
|
|
58
|
+
propagateTags: ecs.PropagateManagedInstancesTags.CAPACITY_PROVIDER,
|
|
59
|
+
instanceRequirements: {
|
|
60
|
+
vCpuCountMin: 1,
|
|
61
|
+
memoryMin: cdk.Size.gibibytes(2),
|
|
62
|
+
cpuManufacturers: [ec2.CpuManufacturer.INTEL],
|
|
63
|
+
acceleratorManufacturers: [ec2.AcceleratorManufacturer.NVIDIA],
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Add FMI capacity provider to cluster
|
|
68
|
+
cluster.addManagedInstancesCapacityProvider(miCapacityProvider);
|
|
69
|
+
|
|
70
|
+
// Create a task definition compatible with Managed Instances and Fargate
|
|
71
|
+
const taskDefinition = new ecs.TaskDefinition(stack, 'TaskDef', {
|
|
72
|
+
compatibility: ecs.Compatibility.FARGATE_AND_MANAGED_INSTANCES,
|
|
73
|
+
cpu: '256',
|
|
74
|
+
memoryMiB: '512',
|
|
75
|
+
networkMode: ecs.NetworkMode.AWS_VPC,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
taskDefinition.addContainer('web', {
|
|
79
|
+
image: ecs.ContainerImage.fromRegistry('public.ecr.aws/docker/library/httpd:2.4'),
|
|
80
|
+
memoryLimitMiB: 512,
|
|
81
|
+
portMappings: [
|
|
82
|
+
{
|
|
83
|
+
containerPort: 80,
|
|
84
|
+
protocol: ecs.Protocol.TCP,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Create a service using the MI capacity provider
|
|
90
|
+
new ecs.FargateService(stack, 'ManagedInstancesService', {
|
|
91
|
+
cluster,
|
|
92
|
+
taskDefinition,
|
|
93
|
+
capacityProviderStrategies: [
|
|
94
|
+
{
|
|
95
|
+
capacityProvider: miCapacityProvider.capacityProviderName,
|
|
96
|
+
weight: 1,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
desiredCount: 1,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
new integ.IntegTest(app, 'ManagedInstancesCapacityProviders', {
|
|
103
|
+
testCases: [stack],
|
|
104
|
+
regions: ['us-west-2'],
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
app.synth();
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
2
|
+
import * as ecs from 'aws-cdk-lib/aws-ecs';
|
|
3
|
+
import * as cdk from 'aws-cdk-lib';
|
|
4
|
+
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
5
|
+
import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns';
|
|
6
|
+
|
|
7
|
+
const app = new cdk.App();
|
|
8
|
+
const stack = new cdk.Stack(app, 'aws-ecs-integ-alb-fargate-public-private-switch');
|
|
9
|
+
|
|
10
|
+
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2, restrictDefaultSecurityGroup: false });
|
|
11
|
+
const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc });
|
|
12
|
+
|
|
13
|
+
// Test private load balancer (the problematic case from the issue)
|
|
14
|
+
new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'PrivateALBFargateService', {
|
|
15
|
+
cluster,
|
|
16
|
+
memoryLimitMiB: 1024,
|
|
17
|
+
cpu: 512,
|
|
18
|
+
publicLoadBalancer: false, // This should create ECSPrivate target group
|
|
19
|
+
taskImageOptions: {
|
|
20
|
+
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Test public load balancer for comparison
|
|
25
|
+
new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'PublicALBFargateService', {
|
|
26
|
+
cluster,
|
|
27
|
+
memoryLimitMiB: 1024,
|
|
28
|
+
cpu: 512,
|
|
29
|
+
publicLoadBalancer: true, // This should create ECS target group
|
|
30
|
+
taskImageOptions: {
|
|
31
|
+
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
new integ.IntegTest(app, 'ALBFargatePublicPrivateSwitchTest', {
|
|
36
|
+
testCases: [stack],
|
|
37
|
+
allowDestroy: [
|
|
38
|
+
'PrivateALBFargateServiceLB3F43693F',
|
|
39
|
+
'PrivateALBFargateServiceLBPublicListenerECSPrivateGroup81AA5B8B',
|
|
40
|
+
'PublicALBFargateServiceLBBDD839E7',
|
|
41
|
+
'PublicALBFargateServiceLBPublicListenerECSGroupD991EA00',
|
|
42
|
+
],
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
app.synth();
|
|
@@ -147,6 +147,26 @@ new eks.Cluster(this, 'HelloEKS', {
|
|
|
147
147
|
});
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
+
You can control what happens to the resources created by the cluster construct when they are no longer managed by CloudFormation by specifying a `removalPolicy`.
|
|
151
|
+
|
|
152
|
+
This can happen in one of three situations:
|
|
153
|
+
- The resource is removed from the template, so CloudFormation stops managing it;
|
|
154
|
+
- A change to the resource is made that requires it to be replaced, so CloudFormation stops managing it;
|
|
155
|
+
- The stack is deleted, so CloudFormation stops managing all resources in it.
|
|
156
|
+
|
|
157
|
+
This affects the EKS cluster itself, the custom resource that created the cluster, associated IAM roles, node groups, security groups, VPC and any other CloudFormation resources managed by this construct.
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
import { KubectlV33Layer } from '@aws-cdk/lambda-layer-kubectl-v33';
|
|
161
|
+
import * as core from 'aws-cdk-lib/core';
|
|
162
|
+
|
|
163
|
+
new eks.Cluster(this, 'HelloEKS', {
|
|
164
|
+
version: eks.KubernetesVersion.V1_33,
|
|
165
|
+
kubectlLayer: new KubectlV33Layer(this, 'kubectl'),
|
|
166
|
+
removalPolicy: core.RemovalPolicy.RETAIN, // Keep all resources created by the construct.
|
|
167
|
+
});
|
|
168
|
+
```
|
|
169
|
+
|
|
150
170
|
You can also use `FargateCluster` to provision a cluster that uses only fargate workers.
|
|
151
171
|
|
|
152
172
|
```ts
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// !cdk-integ pragma:disable-update-workflow
|
|
2
|
+
import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib';
|
|
3
|
+
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
4
|
+
import { getClusterVersionConfig } from './integ-tests-kubernetes-version';
|
|
5
|
+
import * as eks from 'aws-cdk-lib/aws-eks';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This test just checks that all resources can be deployed with a removal policy.
|
|
9
|
+
* We use the DESTROY policy here to avoid leaving orphaned resources behind, but if it works for DESTROY, it should work for other values as well.
|
|
10
|
+
*/
|
|
11
|
+
class EksClusterRemovalPolicyStack extends Stack {
|
|
12
|
+
constructor(scope: App, id: string, props?: StackProps) {
|
|
13
|
+
super(scope, id, props);
|
|
14
|
+
|
|
15
|
+
new eks.Cluster(this, 'Cluster', {
|
|
16
|
+
...getClusterVersionConfig(this, eks.KubernetesVersion.V1_32),
|
|
17
|
+
removalPolicy: RemovalPolicy.DESTROY,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const app = new App();
|
|
23
|
+
|
|
24
|
+
const stack = new EksClusterRemovalPolicyStack(app, 'EksClusterRemovalPolicyStack');
|
|
25
|
+
|
|
26
|
+
new integ.IntegTest(app, 'eks-cluster-removal-policy-integ', {
|
|
27
|
+
testCases: [stack],
|
|
28
|
+
diffAssets: false,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
app.synth();
|
|
@@ -19,7 +19,7 @@ const vpc = new ec2.Vpc(stack, 'VPC', {
|
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
const fn = new lambda.Function(stack, 'Function', {
|
|
22
|
-
runtime: lambda.Runtime.
|
|
22
|
+
runtime: lambda.Runtime.NODEJS_20_X,
|
|
23
23
|
handler: 'index.handler',
|
|
24
24
|
code: lambda.Code.fromInline(`
|
|
25
25
|
exports.handler = async (event) => {
|
|
@@ -186,7 +186,7 @@ const signinFunction = new lambda.Function(testCase, 'Signin', {
|
|
|
186
186
|
functionName: 'cdk-integ-alb-oidc-signin-handler',
|
|
187
187
|
code: lambda.Code.fromAsset('alb-oidc-signin-handler', { exclude: ['*.ts'] }),
|
|
188
188
|
handler: 'index.handler',
|
|
189
|
-
runtime: lambda.Runtime.
|
|
189
|
+
runtime: lambda.Runtime.NODEJS_20_X,
|
|
190
190
|
environment: {
|
|
191
191
|
TEST_USERNAME: testUser.username,
|
|
192
192
|
TEST_PASSWORD: testUser.password,
|
|
@@ -206,7 +206,7 @@ const signinFunction = new lambda.Function(testCase, 'Signin', {
|
|
|
206
206
|
functionName: 'cdk-integ-alb-cognito-signin-handler',
|
|
207
207
|
code: lambda.Code.fromAsset('alb-cognito-signin-handler', { exclude: ['*.ts'] }),
|
|
208
208
|
handler: 'index.handler',
|
|
209
|
-
runtime: lambda.Runtime.
|
|
209
|
+
runtime: lambda.Runtime.NODEJS_20_X,
|
|
210
210
|
environment: {
|
|
211
211
|
TEST_USERNAME: testUser.username,
|
|
212
212
|
TEST_PASSWORD: testUser.password,
|
|
@@ -15,6 +15,7 @@ intake and aggregation.
|
|
|
15
15
|
- [Write Permissions](#write-permissions)
|
|
16
16
|
- [Custom Permissions](#custom-permissions)
|
|
17
17
|
- [Metrics](#metrics)
|
|
18
|
+
- [Shard-level Metrics](#shard-level-metrics)
|
|
18
19
|
- [Stream Consumers](#stream-consumers)
|
|
19
20
|
- [Read Permissions](#read-permissions-1)
|
|
20
21
|
- [Resource Policy](#resource-policy)
|
|
@@ -191,6 +192,47 @@ stream.metricGetRecordsSuccess();
|
|
|
191
192
|
stream.metricGetRecordsSuccess({ statistic: 'Maximum' });
|
|
192
193
|
```
|
|
193
194
|
|
|
195
|
+
#### Shard-level Metrics
|
|
196
|
+
|
|
197
|
+
You can enable enhanced shard-level metrics for your Kinesis stream to get detailed monitoring of individual shards. Shard-level metrics provide more granular insights into the performance and health of your stream.
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
const stream = new kinesis.Stream(this, 'MyStream', {
|
|
201
|
+
shardLevelMetrics: [kinesis.ShardLevelMetrics.ALL],
|
|
202
|
+
});
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
You can also specify individual metrics that you want to monitor:
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
const stream = new kinesis.Stream(this, 'MyStream', {
|
|
209
|
+
shardLevelMetrics: [
|
|
210
|
+
kinesis.ShardLevelMetrics.INCOMING_BYTES,
|
|
211
|
+
kinesis.ShardLevelMetrics.INCOMING_RECORDS,
|
|
212
|
+
kinesis.ShardLevelMetrics.ITERATOR_AGE_MILLISECONDS,
|
|
213
|
+
kinesis.ShardLevelMetrics.OUTGOING_BYTES,
|
|
214
|
+
kinesis.ShardLevelMetrics.OUTGOING_RECORDS,
|
|
215
|
+
kinesis.ShardLevelMetrics.READ_PROVISIONED_THROUGHPUT_EXCEEDED,
|
|
216
|
+
kinesis.ShardLevelMetrics.WRITE_PROVISIONED_THROUGHPUT_EXCEEDED,
|
|
217
|
+
],
|
|
218
|
+
});
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Available shard-level metrics include:
|
|
222
|
+
|
|
223
|
+
- `INCOMING_BYTES` - The number of bytes successfully put to the shard
|
|
224
|
+
- `INCOMING_RECORDS` - The number of records successfully put to the shard
|
|
225
|
+
- `ITERATOR_AGE_MILLISECONDS` - The age of the last record in all GetRecords calls made against a shard
|
|
226
|
+
- `OUTGOING_BYTES` - The number of bytes retrieved from the shard
|
|
227
|
+
- `OUTGOING_RECORDS` - The number of records retrieved from the shard
|
|
228
|
+
- `READ_PROVISIONED_THROUGHPUT_EXCEEDED` - The number of GetRecords calls throttled for the shard
|
|
229
|
+
- `WRITE_PROVISIONED_THROUGHPUT_EXCEEDED` - The number of records rejected due to throttling for the shard
|
|
230
|
+
- `ALL` - All available metrics
|
|
231
|
+
|
|
232
|
+
Note: You cannot specify `ALL` together with other individual metrics. If you want all metrics, use `ALL` alone.
|
|
233
|
+
|
|
234
|
+
For more information about shard-level metrics, see [Monitoring the Amazon Kinesis Data Streams Service with Amazon CloudWatch](https://docs.aws.amazon.com/streams/latest/dev/monitoring-with-cloudwatch.html#kinesis-metrics-shard).
|
|
235
|
+
|
|
194
236
|
## Stream Consumers
|
|
195
237
|
|
|
196
238
|
Creating stream consumers allow consumers to receive data from the stream using enhanced fan-out at a rate of up to 2 MiB per second for every shard.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { App, Stack, RemovalPolicies } from 'aws-cdk-lib';
|
|
2
|
+
import * as kinesis from 'aws-cdk-lib/aws-kinesis';
|
|
3
|
+
import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
4
|
+
|
|
5
|
+
const app = new App();
|
|
6
|
+
const stack = new Stack(app, 'kinesis-stream-shard-level-monitoring-stack');
|
|
7
|
+
|
|
8
|
+
const explicitStream = new kinesis.Stream(stack, 'ExplicitStream', {
|
|
9
|
+
shardLevelMetrics: [
|
|
10
|
+
kinesis.ShardLevelMetrics.INCOMING_BYTES,
|
|
11
|
+
kinesis.ShardLevelMetrics.INCOMING_RECORDS,
|
|
12
|
+
kinesis.ShardLevelMetrics.ITERATOR_AGE_MILLISECONDS,
|
|
13
|
+
kinesis.ShardLevelMetrics.OUTGOING_BYTES,
|
|
14
|
+
kinesis.ShardLevelMetrics.OUTGOING_RECORDS,
|
|
15
|
+
kinesis.ShardLevelMetrics.WRITE_PROVISIONED_THROUGHPUT_EXCEEDED,
|
|
16
|
+
kinesis.ShardLevelMetrics.READ_PROVISIONED_THROUGHPUT_EXCEEDED,
|
|
17
|
+
],
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const allStream = new kinesis.Stream(stack, 'AllStream', {
|
|
21
|
+
shardLevelMetrics: [kinesis.ShardLevelMetrics.ALL],
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
RemovalPolicies.of(stack).destroy();
|
|
25
|
+
|
|
26
|
+
const integ = new IntegTest(app, 'integ-kinesis-stream-consumer', {
|
|
27
|
+
testCases: [stack],
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const streams = [explicitStream, allStream];
|
|
31
|
+
streams.forEach((stream) => {
|
|
32
|
+
integ.assertions.awsApiCall('Kinesis', 'describeStream', {
|
|
33
|
+
StreamName: stream.streamName,
|
|
34
|
+
}).expect(ExpectedResult.objectLike({
|
|
35
|
+
StreamDescription: {
|
|
36
|
+
ShardLevelMetrics: [
|
|
37
|
+
'IncomingBytes',
|
|
38
|
+
'IncomingRecords',
|
|
39
|
+
'IteratorAgeMilliseconds',
|
|
40
|
+
'OutgoingBytes',
|
|
41
|
+
'OutgoingRecords',
|
|
42
|
+
'WriteProvisionedThroughputExceeded',
|
|
43
|
+
'ReadProvisionedThroughputExceeded',
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
}));
|
|
47
|
+
});
|