Skip to content

Commit

Permalink
feat(sns): message archive policy (#29008)
Browse files Browse the repository at this point in the history
### 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*
  • Loading branch information
badmintoncryer authored and TheRealAmazonKendra committed Feb 9, 2024
1 parent acdeca9 commit c759895
Show file tree
Hide file tree
Showing 12 changed files with 491 additions and 2 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"Resources": {
"MyTopic86869434": {
"Type": "AWS::SNS::Topic",
"Properties": {
"ArchivePolicy": {
"MessageRetentionPeriod": 12
},
"FifoTopic": true,
"TopicName": "SNSFifoArchivePolicyStack-MyTopic-5C2C77AF.fifo"
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c759895

Please sign in to comment.