# TopicAttributes

Represents an SNS topic defined outside of this stack.

- Source: [`aws-sns/lib/topic.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-sns/lib/topic.ts#L223)
- Type last changed: v2.182.0 · 5 Mar 2025

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_sns as sns } from 'aws-cdk-lib';
const topicAttributes: sns.TopicAttributes = {
  topicArn: 'topicArn',

  // the properties below are optional
  contentBasedDeduplication: false,
  keyArn: 'keyArn',
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_sns as sns

topic_attributes = sns.TopicAttributes(
    topic_arn="topicArn",

    # the properties below are optional
    content_based_deduplication=False,
    key_arn="keyArn"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.sns.*;

TopicAttributes topicAttributes = TopicAttributes.builder()
        .topicArn("topicArn")

        // the properties below are optional
        .contentBasedDeduplication(false)
        .keyArn("keyArn")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.SNS;

var topicAttributes = new TopicAttributes {
    TopicArn = "topicArn",

    // the properties below are optional
    ContentBasedDeduplication = false,
    KeyArn = "keyArn"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

topicAttributes := &TopicAttributes{
	TopicArn: jsii.String("topicArn"),

	// the properties below are optional
	ContentBasedDeduplication: jsii.Boolean(false),
	KeyArn: jsii.String("keyArn"),
}
```

## Properties

- `contentBasedDeduplication`: boolean = false — Whether content-based deduplication is enabled.

  Only applicable for FIFO topics.

- `keyArn`: string = None — KMS encryption key, if this topic is server-side encrypted by a KMS key.

- `topicArn`: string (required) — The ARN of the SNS topic.
