Skip to content

Commit 9782f6b

Browse files
feat(sns): message archive policy (#29008)
### Issue Closes #29007. ### Reason for this change [In October 2023, it became possible to set a message archive policy for FIFO topics](https://aws.amazon.com/jp/blogs/compute/archiving-and-replaying-messages-with-amazon-sns-fifo/). While this could be configured via CloudFormation (Cfn), it was not possible to do so from the L2 construct. ### Description of changes In this pull request, the "messageRetentionPeriodInDays" parameter has been added to the Topic class, enabling the configuration of the message archive policy. ```ts new Topic(this, 'MyTopic', { fifo: true, // only fifo topic messageRetentionPeriodInDays: 12, // added }); ``` ### Description of how you validated changes I've added unit and integ tests. ### 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 431df3b commit 9782f6b

12 files changed

+491
-2
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo-archive-policy.js.snapshot/SNSFifoArchivePolicyStack.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,48 @@
1+
{
2+
"Resources": {
3+
"MyTopic86869434": {
4+
"Type": "AWS::SNS::Topic",
5+
"Properties": {
6+
"ArchivePolicy": {
7+
"MessageRetentionPeriod": 12
8+
},
9+
"FifoTopic": true,
10+
"TopicName": "SNSFifoArchivePolicyStack-MyTopic-5C2C77AF.fifo"
11+
}
12+
}
13+
},
14+
"Parameters": {
15+
"BootstrapVersion": {
16+
"Type": "AWS::SSM::Parameter::Value<String>",
17+
"Default": "/cdk-bootstrap/hnb659fds/version",
18+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
19+
}
20+
},
21+
"Rules": {
22+
"CheckBootstrapVersion": {
23+
"Assertions": [
24+
{
25+
"Assert": {
26+
"Fn::Not": [
27+
{
28+
"Fn::Contains": [
29+
[
30+
"1",
31+
"2",
32+
"3",
33+
"4",
34+
"5"
35+
],
36+
{
37+
"Ref": "BootstrapVersion"
38+
}
39+
]
40+
}
41+
]
42+
},
43+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
44+
}
45+
]
46+
}
47+
}
48+
}

packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo-archive-policy.js.snapshot/SqsTestDefaultTestDeployAssert659366A6.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-sns/test/integ.sns-fifo-archive-policy.js.snapshot/SqsTestDefaultTestDeployAssert659366A6.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-sns/test/integ.sns-fifo-archive-policy.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-sns/test/integ.sns-fifo-archive-policy.js.snapshot/integ.json

+12
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-sns/test/integ.sns-fifo-archive-policy.js.snapshot/manifest.json

+113
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-sns/test/integ.sns-fifo-archive-policy.js.snapshot/tree.json

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

0 commit comments

Comments
 (0)