Topic

Provides an SNS topic resource

Example with Delivery Policy

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const userUpdates = new aws.sns.Topic("user_updates", {
    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 Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var userUpdates = new Aws.Sns.Topic("userUpdates", new Aws.Sns.TopicArgs
        {
            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 (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/sns"
	"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sns.NewTopic(ctx, "userUpdates", &sns.TopicArgs{
			DeliveryPolicy: pulumi.String(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\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", "\n")),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

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", {
    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 Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var userUpdates = new Aws.Sns.Topic("userUpdates", new Aws.Sns.TopicArgs
        {
            KmsMasterKeyId = "alias/aws/sns",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/sns"
	"github.com/pulumi/pulumi/sdk/v2/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
	})
}

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.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var userUpdates = new Aws.Sns.Topic("userUpdates", new Aws.Sns.TopicArgs
        {
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/sns"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := sns.NewTopic(ctx, "userUpdates", nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

user_updates = aws.sns.Topic("userUpdates")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const userUpdates = new aws.sns.Topic("user_updates", {});

Create a Topic Resource

new Topic(name: string, args?: TopicArgs, opts?: CustomResourceOptions);
def Topic(resource_name, opts=None, application_failure_feedback_role_arn=None, application_success_feedback_role_arn=None, application_success_feedback_sample_rate=None, delivery_policy=None, display_name=None, http_failure_feedback_role_arn=None, http_success_feedback_role_arn=None, http_success_feedback_sample_rate=None, kms_master_key_id=None, lambda_failure_feedback_role_arn=None, lambda_success_feedback_role_arn=None, lambda_success_feedback_sample_rate=None, name=None, name_prefix=None, policy=None, sqs_failure_feedback_role_arn=None, sqs_success_feedback_role_arn=None, sqs_success_feedback_sample_rate=None, tags=None, __props__=None);
func NewTopic(ctx *Context, name string, args *TopicArgs, opts ...ResourceOption) (*Topic, error)
public Topic(string name, TopicArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args TopicArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args TopicArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args TopicArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Topic Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The Topic resource accepts the following input properties:

ApplicationFailureFeedbackRoleArn string

IAM role for failure feedback

ApplicationSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

ApplicationSuccessFeedbackSampleRate int

Percentage of success to sample

DeliveryPolicy string

The SNS delivery policy. More on AWS documentation

DisplayName string

The display name for the SNS topic

HttpFailureFeedbackRoleArn string

IAM role for failure feedback

HttpSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

HttpSuccessFeedbackSampleRate int

Percentage of success to sample

KmsMasterKeyId string

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

LambdaFailureFeedbackRoleArn string

IAM role for failure feedback

LambdaSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

LambdaSuccessFeedbackSampleRate int

Percentage of success to sample

Name string

The friendly name for the SNS topic. By default generated by this provider.

NamePrefix string

The friendly name for the SNS topic. Conflicts with name.

Policy string

The fully-formed AWS policy as JSON.

SqsFailureFeedbackRoleArn string

IAM role for failure feedback

SqsSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

SqsSuccessFeedbackSampleRate int

Percentage of success to sample

Tags Dictionary<string, string>

Key-value map of resource tags

ApplicationFailureFeedbackRoleArn string

IAM role for failure feedback

ApplicationSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

ApplicationSuccessFeedbackSampleRate int

Percentage of success to sample

DeliveryPolicy string

The SNS delivery policy. More on AWS documentation

DisplayName string

The display name for the SNS topic

HttpFailureFeedbackRoleArn string

IAM role for failure feedback

HttpSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

HttpSuccessFeedbackSampleRate int

Percentage of success to sample

KmsMasterKeyId string

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

LambdaFailureFeedbackRoleArn string

IAM role for failure feedback

LambdaSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

LambdaSuccessFeedbackSampleRate int

Percentage of success to sample

Name string

The friendly name for the SNS topic. By default generated by this provider.

NamePrefix string

The friendly name for the SNS topic. Conflicts with name.

Policy string

The fully-formed AWS policy as JSON.

SqsFailureFeedbackRoleArn string

IAM role for failure feedback

SqsSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

SqsSuccessFeedbackSampleRate int

Percentage of success to sample

Tags map[string]string

Key-value map of resource tags

applicationFailureFeedbackRoleArn string

IAM role for failure feedback

applicationSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

applicationSuccessFeedbackSampleRate number

Percentage of success to sample

deliveryPolicy string

The SNS delivery policy. More on AWS documentation

displayName string

The display name for the SNS topic

httpFailureFeedbackRoleArn string

IAM role for failure feedback

httpSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

httpSuccessFeedbackSampleRate number

Percentage of success to sample

kmsMasterKeyId string

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

lambdaFailureFeedbackRoleArn string

IAM role for failure feedback

lambdaSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

lambdaSuccessFeedbackSampleRate number

Percentage of success to sample

name string

The friendly name for the SNS topic. By default generated by this provider.

namePrefix string

The friendly name for the SNS topic. Conflicts with name.

policy string

The fully-formed AWS policy as JSON.

sqsFailureFeedbackRoleArn string

IAM role for failure feedback

sqsSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

sqsSuccessFeedbackSampleRate number

Percentage of success to sample

tags {[key: string]: string}

Key-value map of resource tags

application_failure_feedback_role_arn str

IAM role for failure feedback

application_success_feedback_role_arn str

The IAM role permitted to receive success feedback for this topic

application_success_feedback_sample_rate float

Percentage of success to sample

delivery_policy str

The SNS delivery policy. More on AWS documentation

display_name str

The display name for the SNS topic

http_failure_feedback_role_arn str

IAM role for failure feedback

http_success_feedback_role_arn str

The IAM role permitted to receive success feedback for this topic

http_success_feedback_sample_rate float

Percentage of success to sample

kms_master_key_id str

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

lambda_failure_feedback_role_arn str

IAM role for failure feedback

lambda_success_feedback_role_arn str

The IAM role permitted to receive success feedback for this topic

lambda_success_feedback_sample_rate float

Percentage of success to sample

name str

The friendly name for the SNS topic. By default generated by this provider.

name_prefix str

The friendly name for the SNS topic. Conflicts with name.

policy str

The fully-formed AWS policy as JSON.

sqs_failure_feedback_role_arn str

IAM role for failure feedback

sqs_success_feedback_role_arn str

The IAM role permitted to receive success feedback for this topic

sqs_success_feedback_sample_rate float

Percentage of success to sample

tags Dict[str, str]

Key-value map of resource tags

Outputs

All input properties are implicitly available as output properties. Additionally, the Topic resource produces the following output properties:

Arn string

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

Id string
The provider-assigned unique ID for this managed resource.
Arn string

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

Id string
The provider-assigned unique ID for this managed resource.
arn ARN

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

id string
The provider-assigned unique ID for this managed resource.
arn str

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

id str
The provider-assigned unique ID for this managed resource.

Look up an Existing Topic Resource

Get an existing Topic resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: TopicState, opts?: CustomResourceOptions): Topic
static get(resource_name, id, opts=None, application_failure_feedback_role_arn=None, application_success_feedback_role_arn=None, application_success_feedback_sample_rate=None, arn=None, delivery_policy=None, display_name=None, http_failure_feedback_role_arn=None, http_success_feedback_role_arn=None, http_success_feedback_sample_rate=None, kms_master_key_id=None, lambda_failure_feedback_role_arn=None, lambda_success_feedback_role_arn=None, lambda_success_feedback_sample_rate=None, name=None, name_prefix=None, policy=None, sqs_failure_feedback_role_arn=None, sqs_success_feedback_role_arn=None, sqs_success_feedback_sample_rate=None, tags=None, __props__=None);
func GetTopic(ctx *Context, name string, id IDInput, state *TopicState, opts ...ResourceOption) (*Topic, error)
public static Topic Get(string name, Input<string> id, TopicState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

ApplicationFailureFeedbackRoleArn string

IAM role for failure feedback

ApplicationSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

ApplicationSuccessFeedbackSampleRate int

Percentage of success to sample

Arn string

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

DeliveryPolicy string

The SNS delivery policy. More on AWS documentation

DisplayName string

The display name for the SNS topic

HttpFailureFeedbackRoleArn string

IAM role for failure feedback

HttpSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

HttpSuccessFeedbackSampleRate int

Percentage of success to sample

KmsMasterKeyId string

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

LambdaFailureFeedbackRoleArn string

IAM role for failure feedback

LambdaSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

LambdaSuccessFeedbackSampleRate int

Percentage of success to sample

Name string

The friendly name for the SNS topic. By default generated by this provider.

NamePrefix string

The friendly name for the SNS topic. Conflicts with name.

Policy string

The fully-formed AWS policy as JSON.

SqsFailureFeedbackRoleArn string

IAM role for failure feedback

SqsSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

SqsSuccessFeedbackSampleRate int

Percentage of success to sample

Tags Dictionary<string, string>

Key-value map of resource tags

ApplicationFailureFeedbackRoleArn string

IAM role for failure feedback

ApplicationSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

ApplicationSuccessFeedbackSampleRate int

Percentage of success to sample

Arn string

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

DeliveryPolicy string

The SNS delivery policy. More on AWS documentation

DisplayName string

The display name for the SNS topic

HttpFailureFeedbackRoleArn string

IAM role for failure feedback

HttpSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

HttpSuccessFeedbackSampleRate int

Percentage of success to sample

KmsMasterKeyId string

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

LambdaFailureFeedbackRoleArn string

IAM role for failure feedback

LambdaSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

LambdaSuccessFeedbackSampleRate int

Percentage of success to sample

Name string

The friendly name for the SNS topic. By default generated by this provider.

NamePrefix string

The friendly name for the SNS topic. Conflicts with name.

Policy string

The fully-formed AWS policy as JSON.

SqsFailureFeedbackRoleArn string

IAM role for failure feedback

SqsSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

SqsSuccessFeedbackSampleRate int

Percentage of success to sample

Tags map[string]string

Key-value map of resource tags

applicationFailureFeedbackRoleArn string

IAM role for failure feedback

applicationSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

applicationSuccessFeedbackSampleRate number

Percentage of success to sample

arn ARN

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

deliveryPolicy string

The SNS delivery policy. More on AWS documentation

displayName string

The display name for the SNS topic

httpFailureFeedbackRoleArn string

IAM role for failure feedback

httpSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

httpSuccessFeedbackSampleRate number

Percentage of success to sample

kmsMasterKeyId string

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

lambdaFailureFeedbackRoleArn string

IAM role for failure feedback

lambdaSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

lambdaSuccessFeedbackSampleRate number

Percentage of success to sample

name string

The friendly name for the SNS topic. By default generated by this provider.

namePrefix string

The friendly name for the SNS topic. Conflicts with name.

policy string

The fully-formed AWS policy as JSON.

sqsFailureFeedbackRoleArn string

IAM role for failure feedback

sqsSuccessFeedbackRoleArn string

The IAM role permitted to receive success feedback for this topic

sqsSuccessFeedbackSampleRate number

Percentage of success to sample

tags {[key: string]: string}

Key-value map of resource tags

application_failure_feedback_role_arn str

IAM role for failure feedback

application_success_feedback_role_arn str

The IAM role permitted to receive success feedback for this topic

application_success_feedback_sample_rate float

Percentage of success to sample

arn str

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

delivery_policy str

The SNS delivery policy. More on AWS documentation

display_name str

The display name for the SNS topic

http_failure_feedback_role_arn str

IAM role for failure feedback

http_success_feedback_role_arn str

The IAM role permitted to receive success feedback for this topic

http_success_feedback_sample_rate float

Percentage of success to sample

kms_master_key_id str

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

lambda_failure_feedback_role_arn str

IAM role for failure feedback

lambda_success_feedback_role_arn str

The IAM role permitted to receive success feedback for this topic

lambda_success_feedback_sample_rate float

Percentage of success to sample

name str

The friendly name for the SNS topic. By default generated by this provider.

name_prefix str

The friendly name for the SNS topic. Conflicts with name.

policy str

The fully-formed AWS policy as JSON.

sqs_failure_feedback_role_arn str

IAM role for failure feedback

sqs_success_feedback_role_arn str

The IAM role permitted to receive success feedback for this topic

sqs_success_feedback_sample_rate float

Percentage of success to sample

tags Dict[str, str]

Key-value map of resource tags

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.