Topic

class Topic : KotlinCustomResource

Provides an SNS topic resource

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sns.Topic;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var userUpdates = new Topic("userUpdates");
}
}

Example with Delivery Policy

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const userUpdates = new aws.sns.Topic("userUpdates", {deliveryPolicy: `{
"http": {
"defaultHealthyRetryPolicy": {
"minDelayTarget": 20,
"maxDelayTarget": 20,
"numRetries": 3,
"numMaxDelayRetries": 0,
"numNoDelayRetries": 0,
"numMinDelayRetries": 0,
"backoffFunction": "linear"
},
"disableSubscriptionOverrides": false,
"defaultThrottlePolicy": {
"maxReceivesPerSecond": 1
}
}
}
`});
import pulumi
import pulumi_aws as aws
user_updates = aws.sns.Topic("userUpdates", delivery_policy="""{
"http": {
"defaultHealthyRetryPolicy": {
"minDelayTarget": 20,
"maxDelayTarget": 20,
"numRetries": 3,
"numMaxDelayRetries": 0,
"numNoDelayRetries": 0,
"numMinDelayRetries": 0,
"backoffFunction": "linear"
},
"disableSubscriptionOverrides": false,
"defaultThrottlePolicy": {
"maxReceivesPerSecond": 1
}
}
}
""")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var userUpdates = new Aws.Sns.Topic("userUpdates", new()
{
DeliveryPolicy = @"{
""http"": {
""defaultHealthyRetryPolicy"": {
""minDelayTarget"": 20,
""maxDelayTarget"": 20,
""numRetries"": 3,
""numMaxDelayRetries"": 0,
""numNoDelayRetries"": 0,
""numMinDelayRetries"": 0,
""backoffFunction"": ""linear""
},
""disableSubscriptionOverrides"": false,
""defaultThrottlePolicy"": {
""maxReceivesPerSecond"": 1
}
}
}
",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/sns"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sns.NewTopic(ctx, "userUpdates", &sns.TopicArgs{
DeliveryPolicy: pulumi.String(`{
"http": {
"defaultHealthyRetryPolicy": {
"minDelayTarget": 20,
"maxDelayTarget": 20,
"numRetries": 3,
"numMaxDelayRetries": 0,
"numNoDelayRetries": 0,
"numMinDelayRetries": 0,
"backoffFunction": "linear"
},
"disableSubscriptionOverrides": false,
"defaultThrottlePolicy": {
"maxReceivesPerSecond": 1
}
}
}
`),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sns.Topic;
import com.pulumi.aws.sns.TopicArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var userUpdates = new Topic("userUpdates", TopicArgs.builder()
.deliveryPolicy("""
{
"http": {
"defaultHealthyRetryPolicy": {
"minDelayTarget": 20,
"maxDelayTarget": 20,
"numRetries": 3,
"numMaxDelayRetries": 0,
"numNoDelayRetries": 0,
"numMinDelayRetries": 0,
"backoffFunction": "linear"
},
"disableSubscriptionOverrides": false,
"defaultThrottlePolicy": {
"maxReceivesPerSecond": 1
}
}
}
""")
.build());
}
}
resources:
userUpdates:
type: aws:sns:Topic
properties:
deliveryPolicy: |+
{
"http": {
"defaultHealthyRetryPolicy": {
"minDelayTarget": 20,
"maxDelayTarget": 20,
"numRetries": 3,
"numMaxDelayRetries": 0,
"numNoDelayRetries": 0,
"numMinDelayRetries": 0,
"backoffFunction": "linear"
},
"disableSubscriptionOverrides": false,
"defaultThrottlePolicy": {
"maxReceivesPerSecond": 1
}
}
}

Example with Server-side encryption (SSE)

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const userUpdates = new aws.sns.Topic("userUpdates", {kmsMasterKeyId: "alias/aws/sns"});
import pulumi
import pulumi_aws as aws
user_updates = aws.sns.Topic("userUpdates", kms_master_key_id="alias/aws/sns")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var userUpdates = new Aws.Sns.Topic("userUpdates", new()
{
KmsMasterKeyId = "alias/aws/sns",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/sns"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sns.NewTopic(ctx, "userUpdates", &sns.TopicArgs{
KmsMasterKeyId: pulumi.String("alias/aws/sns"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sns.Topic;
import com.pulumi.aws.sns.TopicArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var userUpdates = new Topic("userUpdates", TopicArgs.builder()
.kmsMasterKeyId("alias/aws/sns")
.build());
}
}
resources:
userUpdates:
type: aws:sns:Topic
properties:
kmsMasterKeyId: alias/aws/sns

Example with First-In-First-Out (FIFO)

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const userUpdates = new aws.sns.Topic("userUpdates", {
contentBasedDeduplication: true,
fifoTopic: true,
});
import pulumi
import pulumi_aws as aws
user_updates = aws.sns.Topic("userUpdates",
content_based_deduplication=True,
fifo_topic=True)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var userUpdates = new Aws.Sns.Topic("userUpdates", new()
{
ContentBasedDeduplication = true,
FifoTopic = true,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/sns"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sns.NewTopic(ctx, "userUpdates", &sns.TopicArgs{
ContentBasedDeduplication: pulumi.Bool(true),
FifoTopic: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sns.Topic;
import com.pulumi.aws.sns.TopicArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var userUpdates = new Topic("userUpdates", TopicArgs.builder()
.contentBasedDeduplication(true)
.fifoTopic(true)
.build());
}
}
resources:
userUpdates:
type: aws:sns:Topic
properties:
contentBasedDeduplication: true
fifoTopic: true

Message Delivery Status Arguments

The <endpoint>_success_feedback_role_arn and <endpoint>_failure_feedback_role_arn arguments are used to give Amazon SNS write access to use CloudWatch Logs on your behalf. The <endpoint>_success_feedback_sample_rate argument is for specifying the sample rate percentage (0-100) of successfully delivered messages. After you configure the <endpoint>_failure_feedback_role_arn argument, then all failed message deliveries generate CloudWatch Logs.

Import

SNS Topics can be imported using the topic arn, e.g.,

$ pulumi import aws:sns/topic:Topic user_updates arn:aws:sns:us-west-2:0123456789012:my-topic

Properties

Link copied to clipboard

IAM role for failure feedback

Link copied to clipboard

The IAM role permitted to receive success feedback for this topic

Link copied to clipboard

Percentage of success to sample

Link copied to clipboard
val arn: Output<String>

The ARN of the SNS topic, as a more obvious property (clone of id)

Link copied to clipboard

Enables content-based deduplication for FIFO topics. For more information, see the related documentation

Link copied to clipboard
val deliveryPolicy: Output<String>?

The SNS delivery policy. More on AWS documentation

Link copied to clipboard
val displayName: Output<String>?

The display name for the topic

Link copied to clipboard
val fifoTopic: Output<Boolean>?

Boolean indicating whether or not to create a FIFO (first-in-first-out) topic (default is false).

Link copied to clipboard

IAM role for failure feedback

Link copied to clipboard

The IAM role permitted to receive success feedback for this topic

Link copied to clipboard

Percentage of success to sample

Link copied to clipboard

IAM role for failure feedback

Link copied to clipboard

The IAM role permitted to receive success feedback for this topic

Link copied to clipboard

Percentage of success to sample

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val kmsMasterKeyId: Output<String>?

The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK. For more information, see Key Terms

Link copied to clipboard

IAM role for failure feedback

Link copied to clipboard

The IAM role permitted to receive success feedback for this topic

Link copied to clipboard

Percentage of success to sample

Link copied to clipboard
val name: Output<String>

The name of the topic. Topic names must be made up of only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens, and must be between 1 and 256 characters long. For a FIFO (first-in-first-out) topic, the name must end with the .fifo suffix. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix

Link copied to clipboard
val namePrefix: Output<String>

Creates a unique name beginning with the specified prefix. Conflicts with name

Link copied to clipboard
val owner: Output<String>

The AWS Account ID of the SNS topic owner

Link copied to clipboard
val policy: Output<String>

The fully-formed AWS policy as JSON.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val signatureVersion: Output<Int>

If SignatureVersion should be 1 (SHA1) or 2 (SHA256). 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.

Link copied to clipboard

IAM role for failure feedback

Link copied to clipboard

The IAM role permitted to receive success feedback for this topic

Link copied to clipboard

Percentage of success to sample

Link copied to clipboard
val tags: Output<Map<String, String>>?

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard
val tracingConfig: Output<String>

Tracing mode of an Amazon SNS topic. Valid values: "PassThrough", "Active".

Link copied to clipboard
val urn: Output<String>