# TopicProps

Properties for a new SNS topic.

Used as props by: [Topic](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sns.Topic.html)

- Source: [`aws-sns/lib/topic.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-sns/lib/topic.ts#L20)
- Type last changed: v2.178.0 · 6 Feb 2025

## Example

TypeScript:

```ts
const topic = new sns.Topic(this, 'MyTopic', {
  fifo: true,
  fifoThroughputScope: sns.FifoThroughputScope.TOPIC,
});
```

Python:

```python
topic = sns.Topic(self, "MyTopic",
    fifo=True,
    fifo_throughput_scope=sns.FifoThroughputScope.TOPIC
)
```

Java:

```java
Topic topic = Topic.Builder.create(this, "MyTopic")
        .fifo(true)
        .fifoThroughputScope(FifoThroughputScope.TOPIC)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var topic = new Topic(this, "MyTopic", new TopicProps {
    Fifo = true,
    FifoThroughputScope = FifoThroughputScope.TOPIC
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
topic := sns.NewTopic(this, jsii.String("MyTopic"), &TopicProps{
	Fifo: jsii.Boolean(true),
	FifoThroughputScope: sns.FifoThroughputScope_TOPIC,
})
```

## Properties

- `contentBasedDeduplication`: boolean = None — Enables content-based deduplication for FIFO topics.

- `displayName`: string = None — A developer-defined string that can be used to identify this SNS topic.

  The display name must be maximum 100 characters long, including hyphens (-),
  underscores (_), spaces, and tabs.

- `enforceSSL`: boolean = false — Adds a statement to enforce encryption of data in transit when publishing to the topic.

- `fifo`: boolean = None — Set to true to create a FIFO topic.

- `fifoThroughputScope`: [FifoThroughputScope](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sns.FifoThroughputScope.html) — Specifies the throughput quota and deduplication behavior to apply for the FIFO topic.

  **Default:** undefined - SNS default setting is FifoThroughputScope.TOPIC

  You can only set this property when `fifo` is `true`.

- `loggingConfigs`: [LoggingConfig](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sns.LoggingConfig.html)[] = None — The list of delivery status logging configurations for the topic.

- `masterKey`: [IKey](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) = None — A KMS Key, either managed by this CDK app, or imported.

- `messageRetentionPeriodInDays`: number — The number of days Amazon SNS retains messages.

  **Default:** do not archive messages

  It can only be set for FIFO topics.

- `signatureVersion`: string = 1 — The signature version corresponds to the hashing algorithm used while creating the signature of the notifications, subscription confirmations, or unsubscribe confirmation messages sent by Amazon SNS.

- `topicName`: string — A name for the topic.

  **Default:** Generated name

  If you don't specify a name, AWS CloudFormation generates a unique
  physical ID and uses that ID for the topic name. For more information,
  see Name Type.

- `tracingConfig`: [TracingConfig](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sns.TracingConfig.html) = TracingConfig.PASS_THROUGH — Tracing mode of an Amazon SNS topic.
