Skip to content

Commit 3f1fecf

Browse files
authoredMar 12, 2025··
feat(lambda): support s3 OFD for Kinesis/DynamoDB (#33739)
### Issue # (if applicable) Closes #<issue number here>. ### Reason for this change Kinesis and DynamoDB has supported S3 as onFailureDestination. ### Description of changes The `supportS3OnFailureDestination` for kinesis and DynamoDB has changed to true Tests are updated to reflect this change. ### Describe any new or updated permissions being added No permission change ### Description of how you validated changes Test are run ### 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 6aca154 commit 3f1fecf

18 files changed

+2879
-50
lines changed
 

‎packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3-onfailuire-destination.js.snapshot/LambdaEventSourceS3OnFailureDestinationIntegDefaultTestDeployAssert62366951.assets.json

+1-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-lambda-event-sources/test/integ.s3-onfailuire-destination.js.snapshot/cdk.out

+1-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-lambda-event-sources/test/integ.s3-onfailuire-destination.js.snapshot/dynamo-with-s3ofd.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,247 @@
1+
{
2+
"Resources": {
3+
"FServiceRole3AC82EE1": {
4+
"Type": "AWS::IAM::Role",
5+
"Properties": {
6+
"AssumeRolePolicyDocument": {
7+
"Statement": [
8+
{
9+
"Action": "sts:AssumeRole",
10+
"Effect": "Allow",
11+
"Principal": {
12+
"Service": "lambda.amazonaws.com"
13+
}
14+
}
15+
],
16+
"Version": "2012-10-17"
17+
},
18+
"ManagedPolicyArns": [
19+
{
20+
"Fn::Join": [
21+
"",
22+
[
23+
"arn:",
24+
{
25+
"Ref": "AWS::Partition"
26+
},
27+
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
28+
]
29+
]
30+
}
31+
]
32+
}
33+
},
34+
"FServiceRoleDefaultPolicy17A19BFA": {
35+
"Type": "AWS::IAM::Policy",
36+
"Properties": {
37+
"PolicyDocument": {
38+
"Statement": [
39+
{
40+
"Action": [
41+
"s3:Abort*",
42+
"s3:DeleteObject*",
43+
"s3:GetBucket*",
44+
"s3:GetObject*",
45+
"s3:List*",
46+
"s3:PutObject",
47+
"s3:PutObjectLegalHold",
48+
"s3:PutObjectRetention",
49+
"s3:PutObjectTagging",
50+
"s3:PutObjectVersionTagging"
51+
],
52+
"Effect": "Allow",
53+
"Resource": [
54+
{
55+
"Fn::GetAtt": [
56+
"B08E7C7AF",
57+
"Arn"
58+
]
59+
},
60+
{
61+
"Fn::Join": [
62+
"",
63+
[
64+
{
65+
"Fn::GetAtt": [
66+
"B08E7C7AF",
67+
"Arn"
68+
]
69+
},
70+
"/*"
71+
]
72+
]
73+
}
74+
]
75+
},
76+
{
77+
"Action": "dynamodb:ListStreams",
78+
"Effect": "Allow",
79+
"Resource": "*"
80+
},
81+
{
82+
"Action": [
83+
"dynamodb:DescribeStream",
84+
"dynamodb:GetRecords",
85+
"dynamodb:GetShardIterator"
86+
],
87+
"Effect": "Allow",
88+
"Resource": {
89+
"Fn::GetAtt": [
90+
"TD925BC7E",
91+
"StreamArn"
92+
]
93+
}
94+
}
95+
],
96+
"Version": "2012-10-17"
97+
},
98+
"PolicyName": "FServiceRoleDefaultPolicy17A19BFA",
99+
"Roles": [
100+
{
101+
"Ref": "FServiceRole3AC82EE1"
102+
}
103+
]
104+
}
105+
},
106+
"FC4345940": {
107+
"Type": "AWS::Lambda::Function",
108+
"Properties": {
109+
"Code": {
110+
"ZipFile": "exports.handler = async function handler(event) {\n console.log('event:', JSON.stringify(event, undefined, 2));\n return { event };\n}"
111+
},
112+
"Handler": "index.handler",
113+
"Role": {
114+
"Fn::GetAtt": [
115+
"FServiceRole3AC82EE1",
116+
"Arn"
117+
]
118+
},
119+
"Runtime": "nodejs18.x"
120+
},
121+
"DependsOn": [
122+
"FServiceRoleDefaultPolicy17A19BFA",
123+
"FServiceRole3AC82EE1"
124+
]
125+
},
126+
"FDynamoDBEventSourcedynamowiths3ofdT1C20A471A278839D": {
127+
"Type": "AWS::Lambda::EventSourceMapping",
128+
"Properties": {
129+
"BatchSize": 5,
130+
"DestinationConfig": {
131+
"OnFailure": {
132+
"Destination": {
133+
"Fn::GetAtt": [
134+
"B08E7C7AF",
135+
"Arn"
136+
]
137+
}
138+
}
139+
},
140+
"EventSourceArn": {
141+
"Fn::GetAtt": [
142+
"TD925BC7E",
143+
"StreamArn"
144+
]
145+
},
146+
"FunctionName": {
147+
"Ref": "FC4345940"
148+
},
149+
"MaximumRetryAttempts": 0,
150+
"StartingPosition": "TRIM_HORIZON",
151+
"TumblingWindowInSeconds": 60
152+
}
153+
},
154+
"TD925BC7E": {
155+
"Type": "AWS::DynamoDB::Table",
156+
"Properties": {
157+
"AttributeDefinitions": [
158+
{
159+
"AttributeName": "id",
160+
"AttributeType": "S"
161+
}
162+
],
163+
"KeySchema": [
164+
{
165+
"AttributeName": "id",
166+
"KeyType": "HASH"
167+
}
168+
],
169+
"ProvisionedThroughput": {
170+
"ReadCapacityUnits": 5,
171+
"WriteCapacityUnits": 5
172+
},
173+
"StreamSpecification": {
174+
"StreamViewType": "NEW_IMAGE"
175+
}
176+
},
177+
"UpdateReplacePolicy": "Delete",
178+
"DeletionPolicy": "Delete"
179+
},
180+
"B08E7C7AF": {
181+
"Type": "AWS::S3::Bucket",
182+
"UpdateReplacePolicy": "Retain",
183+
"DeletionPolicy": "Retain"
184+
}
185+
},
186+
"Outputs": {
187+
"OutputEventSourceMappingArn": {
188+
"Value": {
189+
"Fn::Join": [
190+
"",
191+
[
192+
"arn:",
193+
{
194+
"Ref": "AWS::Partition"
195+
},
196+
":lambda:",
197+
{
198+
"Ref": "AWS::Region"
199+
},
200+
":",
201+
{
202+
"Ref": "AWS::AccountId"
203+
},
204+
":event-source-mapping:",
205+
{
206+
"Ref": "FDynamoDBEventSourcedynamowiths3ofdT1C20A471A278839D"
207+
}
208+
]
209+
]
210+
}
211+
}
212+
},
213+
"Parameters": {
214+
"BootstrapVersion": {
215+
"Type": "AWS::SSM::Parameter::Value<String>",
216+
"Default": "/cdk-bootstrap/hnb659fds/version",
217+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
218+
}
219+
},
220+
"Rules": {
221+
"CheckBootstrapVersion": {
222+
"Assertions": [
223+
{
224+
"Assert": {
225+
"Fn::Not": [
226+
{
227+
"Fn::Contains": [
228+
[
229+
"1",
230+
"2",
231+
"3",
232+
"4",
233+
"5"
234+
],
235+
{
236+
"Ref": "BootstrapVersion"
237+
}
238+
]
239+
}
240+
]
241+
},
242+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
243+
}
244+
]
245+
}
246+
}
247+
}

‎packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3-onfailuire-destination.js.snapshot/integ.json

+4-2
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-lambda-event-sources/test/integ.s3-onfailuire-destination.js.snapshot/kinesis-with-s3ofd.assets.json

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

0 commit comments

Comments
 (0)