Topic class
Provides an SNS topic resource
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const userUpdates = new aws.sns.Topic("user_updates", {name: "user-updates-topic"});
import pulumi
import pulumi_aws as aws
user_updates = aws.sns.Topic("user_updates", name="user-updates-topic")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var userUpdates = new Aws.Sns.Topic("user_updates", new()
{
Name = "user-updates-topic",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sns"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sns.NewTopic(ctx, "user_updates", &sns.TopicArgs{
Name: pulumi.String("user-updates-topic"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_sns_topic" "user_updates" {
name = "user-updates-topic"
}
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.ArrayList;
import java.util.Arrays;
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()
.name("user-updates-topic")
.build());
}
}
resources:
userUpdates:
type: aws:sns:Topic
name: user_updates
properties:
name: user-updates-topic
Example with Delivery Policy
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const userUpdates = new aws.sns.Topic("user_updates", {
name: "user-updates-topic",
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("user_updates",
name="user-updates-topic",
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("user_updates", new()
{
Name = "user-updates-topic",
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/v7/go/aws/sns"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sns.NewTopic(ctx, "user_updates", &sns.TopicArgs{
Name: pulumi.String("user-updates-topic"),
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
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_sns_topic" "user_updates" {
name = "user-updates-topic"
delivery_policy = "{\n \\\"http\\\": {\n \\\"defaultHealthyRetryPolicy\\\": {\n \\\"minDelayTarget\\\": 20,\n \\\"maxDelayTarget\\\": 20,\n \\\"numRetries\\\": 3,\n \\\"numMaxDelayRetries\\\": 0,\n \\\"numNoDelayRetries\\\": 0,\n \\\"numMinDelayRetries\\\": 0,\n \\\"backoffFunction\\\": \\\"linear\\\"\n },\n \\\"disableSubscriptionOverrides\\\": false,\n \\\"defaultThrottlePolicy\\\": {\n \\\"maxReceivesPerSecond\\\": 1\n }\n }\n}\n"
}
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.ArrayList;
import java.util.Arrays;
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()
.name("user-updates-topic")
.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
name: user_updates
properties:
name: user-updates-topic
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("user_updates", {
name: "user-updates-topic",
kmsMasterKeyId: "alias/aws/sns",
});
import pulumi
import pulumi_aws as aws
user_updates = aws.sns.Topic("user_updates",
name="user-updates-topic",
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("user_updates", new()
{
Name = "user-updates-topic",
KmsMasterKeyId = "alias/aws/sns",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sns"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sns.NewTopic(ctx, "user_updates", &sns.TopicArgs{
Name: pulumi.String("user-updates-topic"),
KmsMasterKeyId: pulumi.String("alias/aws/sns"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_sns_topic" "user_updates" {
name = "user-updates-topic"
kms_master_key_id = "alias/aws/sns"
}
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.ArrayList;
import java.util.Arrays;
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()
.name("user-updates-topic")
.kmsMasterKeyId("alias/aws/sns")
.build());
}
}
resources:
userUpdates:
type: aws:sns:Topic
name: user_updates
properties:
name: user-updates-topic
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("user_updates", {
name: "user-updates-topic.fifo",
fifoTopic: true,
contentBasedDeduplication: true,
});
import pulumi
import pulumi_aws as aws
user_updates = aws.sns.Topic("user_updates",
name="user-updates-topic.fifo",
fifo_topic=True,
content_based_deduplication=True)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var userUpdates = new Aws.Sns.Topic("user_updates", new()
{
Name = "user-updates-topic.fifo",
FifoTopic = true,
ContentBasedDeduplication = true,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sns"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sns.NewTopic(ctx, "user_updates", &sns.TopicArgs{
Name: pulumi.String("user-updates-topic.fifo"),
FifoTopic: pulumi.Bool(true),
ContentBasedDeduplication: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_sns_topic" "user_updates" {
name = "user-updates-topic.fifo"
fifo_topic = true
content_based_deduplication = true
}
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.ArrayList;
import java.util.Arrays;
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()
.name("user-updates-topic.fifo")
.fifoTopic(true)
.contentBasedDeduplication(true)
.build());
}
}
resources:
userUpdates:
type: aws:sns:Topic
name: user_updates
properties:
name: user-updates-topic.fifo
fifoTopic: true
contentBasedDeduplication: 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
Identity Schema
Required
arn(String) ARN of the SNS topic.
Using pulumi import, import SNS Topics using the topic arn. For example:
$ pulumi import aws:sns/topic:Topic user_updates arn:aws:sns:us-west-2:123456789012:my-topic
Constructors
- Topic(String name, {TopicArgs? args, CustomResourceOptions? options})
-
Creates a new Topic.
nameThe Pulumi resource name.argsArguments used to configure this Topic. The set of arguments for Topic.optionsResource options controlling this resource's behavior. - Topic.reference(String urn)
- Creates a typed reference to an existing Topic resource.
Properties
-
applicationFailureFeedbackRoleArn
↔ Output<
String?> -
IAM role for failure feedback
latefinal
-
applicationSuccessFeedbackRoleArn
↔ Output<
String?> -
The IAM role permitted to receive success feedback for this topic
latefinal
-
applicationSuccessFeedbackSampleRate
↔ Output<
int?> -
Percentage of success to sample
latefinal
-
archivePolicy
↔ Output<
String?> -
The message archive policy for FIFO topics. More details in the AWS documentation.
latefinal
-
arn
↔ Output<
String> -
The ARN of the SNS topic, as a more obvious property (clone of id)
latefinal
-
beginningArchiveTime
↔ Output<
String> -
The oldest timestamp at which a FIFO topic subscriber can start a replay.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
contentBasedDeduplication
↔ Output<
bool?> -
Enables content-based deduplication for FIFO topics. For more information, see the related documentation
latefinal
-
deliveryPolicy
↔ Output<
String?> -
The SNS delivery policy. More details in the AWS documentation.
latefinal
-
displayName
↔ Output<
String?> -
The display name for the topic
latefinal
-
fifoThroughputScope
↔ Output<
String> -
Enables higher throughput for FIFO topics by adjusting the scope of deduplication. This attribute has two possible values,
TopicandMessageGroup. For more information, see the related documentation.latefinal -
fifoTopic
↔ Output<
bool?> -
Boolean indicating whether or not to create a FIFO (first-in-first-out) topic. FIFO topics can't deliver messages to customer managed endpoints, such as email addresses, mobile apps, SMS, or HTTP(S) endpoints. These endpoint types aren't guaranteed to preserve strict message ordering. Default is
false.latefinal -
firehoseFailureFeedbackRoleArn
↔ Output<
String?> -
IAM role for failure feedback
latefinal
-
firehoseSuccessFeedbackRoleArn
↔ Output<
String?> -
The IAM role permitted to receive success feedback for this topic
latefinal
-
firehoseSuccessFeedbackSampleRate
↔ Output<
int?> -
Percentage of success to sample
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
httpFailureFeedbackRoleArn
↔ Output<
String?> -
IAM role for failure feedback
latefinal
-
httpSuccessFeedbackRoleArn
↔ Output<
String?> -
The IAM role permitted to receive success feedback for this topic
latefinal
-
httpSuccessFeedbackSampleRate
↔ Output<
int?> -
Percentage of success to sample
latefinal
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
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
latefinal
-
lambdaFailureFeedbackRoleArn
↔ Output<
String?> -
IAM role for failure feedback
latefinal
-
lambdaSuccessFeedbackRoleArn
↔ Output<
String?> -
The IAM role permitted to receive success feedback for this topic
latefinal
-
lambdaSuccessFeedbackSampleRate
↔ Output<
int?> -
Percentage of success to sample
latefinal
-
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
.fifosuffix. If omitted, the provider will assign a random, unique name. Conflicts withnamePrefixlatefinal -
namePrefix
↔ Output<
String> -
Creates a unique name beginning with the specified prefix. Conflicts with
namelatefinal -
owner
↔ Output<
String> -
The AWS Account ID of the SNS topic owner
latefinal
-
policy
↔ Output<
String> -
The fully-formed AWS policy as JSON.
latefinal
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
signatureVersion
↔ Output<
int> -
If
SignatureVersionshould 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.latefinal -
sqsFailureFeedbackRoleArn
↔ Output<
String?> -
IAM role for failure feedback
latefinal
-
sqsSuccessFeedbackRoleArn
↔ Output<
String?> -
The IAM role permitted to receive success feedback for this topic
latefinal
-
sqsSuccessFeedbackSampleRate
↔ Output<
int?> -
Percentage of success to sample
latefinal
-
Key-value map of resource tags. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
A map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
tracingConfig
↔ Output<
String> -
Tracing mode of an Amazon SNS topic. Valid values:
"PassThrough","Active".latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited