Skip to content

Commit 358f231

Browse files
authored
feat(events-target): support Dead Letter Queue for Kinesis Stream Event Target (#31435)
### Issue # (if applicable) Closes #31428. ### Reason for this change Kinesis Stream Event Target supports Dead Letter Queue (DLQ). But current [KinesisStream](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events_targets.KinesisStream.html) class in `events-target` does not support it. ### Description of changes Modified [KinesisStreamProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events_targets.KinesisStreamProps.html) to extend [TargetBaseProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events_targets.TargetBaseProps.html), enabling the configuration of DLQ and retry policy. This change has also been applied to other resources in #13600. ### Description of how you validated changes Add a unit test and an integ test. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent ce54461 commit 358f231

File tree

12 files changed

+779
-4
lines changed

12 files changed

+779
-4
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/KinesisDlqDefaultTestDeployAssertE4CFAC29.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/KinesisDlqDefaultTestDeployAssertE4CFAC29.template.json

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/aws-cdk-kinesis-event-target-dlq.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
{
2+
"Resources": {
3+
"MyStream5C050E93": {
4+
"Type": "AWS::Kinesis::Stream",
5+
"Properties": {
6+
"RetentionPeriodHours": 24,
7+
"ShardCount": 1,
8+
"StreamEncryption": {
9+
"Fn::If": [
10+
"AwsCdkKinesisEncryptedStreamsUnsupportedRegions",
11+
{
12+
"Ref": "AWS::NoValue"
13+
},
14+
{
15+
"EncryptionType": "KMS",
16+
"KeyId": "alias/aws/kinesis"
17+
}
18+
]
19+
}
20+
},
21+
"UpdateReplacePolicy": "Retain",
22+
"DeletionPolicy": "Retain"
23+
},
24+
"MyStreamEventsRole5B6CC6AF": {
25+
"Type": "AWS::IAM::Role",
26+
"Properties": {
27+
"AssumeRolePolicyDocument": {
28+
"Statement": [
29+
{
30+
"Action": "sts:AssumeRole",
31+
"Effect": "Allow",
32+
"Principal": {
33+
"Service": "events.amazonaws.com"
34+
}
35+
}
36+
],
37+
"Version": "2012-10-17"
38+
}
39+
}
40+
},
41+
"MyStreamEventsRoleDefaultPolicy2089B49E": {
42+
"Type": "AWS::IAM::Policy",
43+
"Properties": {
44+
"PolicyDocument": {
45+
"Statement": [
46+
{
47+
"Action": [
48+
"kinesis:PutRecord",
49+
"kinesis:PutRecords"
50+
],
51+
"Effect": "Allow",
52+
"Resource": {
53+
"Fn::GetAtt": [
54+
"MyStream5C050E93",
55+
"Arn"
56+
]
57+
}
58+
}
59+
],
60+
"Version": "2012-10-17"
61+
},
62+
"PolicyName": "MyStreamEventsRoleDefaultPolicy2089B49E",
63+
"Roles": [
64+
{
65+
"Ref": "MyStreamEventsRole5B6CC6AF"
66+
}
67+
]
68+
}
69+
},
70+
"Queue4A7E3555": {
71+
"Type": "AWS::SQS::Queue",
72+
"UpdateReplacePolicy": "Delete",
73+
"DeletionPolicy": "Delete"
74+
},
75+
"EveryMinute2BBCEA8F": {
76+
"Type": "AWS::Events::Rule",
77+
"Properties": {
78+
"ScheduleExpression": "rate(1 minute)",
79+
"State": "ENABLED",
80+
"Targets": [
81+
{
82+
"Arn": {
83+
"Fn::GetAtt": [
84+
"MyStream5C050E93",
85+
"Arn"
86+
]
87+
},
88+
"DeadLetterConfig": {
89+
"Arn": {
90+
"Fn::GetAtt": [
91+
"Queue4A7E3555",
92+
"Arn"
93+
]
94+
}
95+
},
96+
"Id": "Target0",
97+
"KinesisParameters": {
98+
"PartitionKeyPath": "$.id"
99+
},
100+
"RetryPolicy": {
101+
"MaximumEventAgeInSeconds": 7200,
102+
"MaximumRetryAttempts": 2
103+
},
104+
"RoleArn": {
105+
"Fn::GetAtt": [
106+
"MyStreamEventsRole5B6CC6AF",
107+
"Arn"
108+
]
109+
}
110+
}
111+
]
112+
}
113+
}
114+
},
115+
"Conditions": {
116+
"AwsCdkKinesisEncryptedStreamsUnsupportedRegions": {
117+
"Fn::Or": [
118+
{
119+
"Fn::Equals": [
120+
{
121+
"Ref": "AWS::Region"
122+
},
123+
"cn-north-1"
124+
]
125+
},
126+
{
127+
"Fn::Equals": [
128+
{
129+
"Ref": "AWS::Region"
130+
},
131+
"cn-northwest-1"
132+
]
133+
}
134+
]
135+
}
136+
},
137+
"Parameters": {
138+
"BootstrapVersion": {
139+
"Type": "AWS::SSM::Parameter::Value<String>",
140+
"Default": "/cdk-bootstrap/hnb659fds/version",
141+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
142+
}
143+
},
144+
"Rules": {
145+
"CheckBootstrapVersion": {
146+
"Assertions": [
147+
{
148+
"Assert": {
149+
"Fn::Not": [
150+
{
151+
"Fn::Contains": [
152+
[
153+
"1",
154+
"2",
155+
"3",
156+
"4",
157+
"5"
158+
],
159+
{
160+
"Ref": "BootstrapVersion"
161+
}
162+
]
163+
}
164+
]
165+
},
166+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
167+
}
168+
]
169+
}
170+
}
171+
}

packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/cdk.out

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/integ.json

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)