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);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:
- Application
Failure stringFeedback Role Arn IAM role for failure feedback
- Application
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Application
Success intFeedback Sample Rate Percentage of success to sample
- Delivery
Policy string The SNS delivery policy. More on AWS documentation
- Display
Name string The display name for the SNS topic
- Http
Failure stringFeedback Role Arn IAM role for failure feedback
- Http
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Http
Success intFeedback Sample Rate Percentage of success to sample
- Kms
Master stringKey Id 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 stringFeedback Role Arn IAM role for failure feedback
- Lambda
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Lambda
Success intFeedback Sample Rate Percentage of success to sample
- Name string
The friendly name for the SNS topic. By default generated by this provider.
- Name
Prefix string The friendly name for the SNS topic. Conflicts with
name.- Policy string
The fully-formed AWS policy as JSON.
- Sqs
Failure stringFeedback Role Arn IAM role for failure feedback
- Sqs
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Sqs
Success intFeedback Sample Rate Percentage of success to sample
- Dictionary<string, string>
Key-value map of resource tags
- Application
Failure stringFeedback Role Arn IAM role for failure feedback
- Application
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Application
Success intFeedback Sample Rate Percentage of success to sample
- Delivery
Policy string The SNS delivery policy. More on AWS documentation
- Display
Name string The display name for the SNS topic
- Http
Failure stringFeedback Role Arn IAM role for failure feedback
- Http
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Http
Success intFeedback Sample Rate Percentage of success to sample
- Kms
Master stringKey Id 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 stringFeedback Role Arn IAM role for failure feedback
- Lambda
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Lambda
Success intFeedback Sample Rate Percentage of success to sample
- Name string
The friendly name for the SNS topic. By default generated by this provider.
- Name
Prefix string The friendly name for the SNS topic. Conflicts with
name.- Policy string
The fully-formed AWS policy as JSON.
- Sqs
Failure stringFeedback Role Arn IAM role for failure feedback
- Sqs
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Sqs
Success intFeedback Sample Rate Percentage of success to sample
- map[string]string
Key-value map of resource tags
- application
Failure stringFeedback Role Arn IAM role for failure feedback
- application
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- application
Success numberFeedback Sample Rate Percentage of success to sample
- delivery
Policy string The SNS delivery policy. More on AWS documentation
- display
Name string The display name for the SNS topic
- http
Failure stringFeedback Role Arn IAM role for failure feedback
- http
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- http
Success numberFeedback Sample Rate Percentage of success to sample
- kms
Master stringKey Id 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 stringFeedback Role Arn IAM role for failure feedback
- lambda
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- lambda
Success numberFeedback Sample Rate Percentage of success to sample
- name string
The friendly name for the SNS topic. By default generated by this provider.
- name
Prefix string The friendly name for the SNS topic. Conflicts with
name.- policy string
The fully-formed AWS policy as JSON.
- sqs
Failure stringFeedback Role Arn IAM role for failure feedback
- sqs
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- sqs
Success numberFeedback Sample Rate Percentage of success to sample
- {[key: string]: string}
Key-value map of resource tags
- application_
failure_ strfeedback_ role_ arn IAM role for failure feedback
- application_
success_ strfeedback_ role_ arn The IAM role permitted to receive success feedback for this topic
- application_
success_ floatfeedback_ sample_ rate 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_ strfeedback_ role_ arn IAM role for failure feedback
- http_
success_ strfeedback_ role_ arn The IAM role permitted to receive success feedback for this topic
- http_
success_ floatfeedback_ sample_ rate Percentage of success to sample
- kms_
master_ strkey_ id 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_ strfeedback_ role_ arn IAM role for failure feedback
- lambda_
success_ strfeedback_ role_ arn The IAM role permitted to receive success feedback for this topic
- lambda_
success_ floatfeedback_ sample_ rate 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_ strfeedback_ role_ arn IAM role for failure feedback
- sqs_
success_ strfeedback_ role_ arn The IAM role permitted to receive success feedback for this topic
- sqs_
success_ floatfeedback_ sample_ rate Percentage of success to sample
- 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:
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): Topicstatic 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:
- Application
Failure stringFeedback Role Arn IAM role for failure feedback
- Application
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Application
Success intFeedback Sample Rate Percentage of success to sample
- Arn string
The ARN of the SNS topic, as a more obvious property (clone of id)
- Delivery
Policy string The SNS delivery policy. More on AWS documentation
- Display
Name string The display name for the SNS topic
- Http
Failure stringFeedback Role Arn IAM role for failure feedback
- Http
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Http
Success intFeedback Sample Rate Percentage of success to sample
- Kms
Master stringKey Id 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 stringFeedback Role Arn IAM role for failure feedback
- Lambda
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Lambda
Success intFeedback Sample Rate Percentage of success to sample
- Name string
The friendly name for the SNS topic. By default generated by this provider.
- Name
Prefix string The friendly name for the SNS topic. Conflicts with
name.- Policy string
The fully-formed AWS policy as JSON.
- Sqs
Failure stringFeedback Role Arn IAM role for failure feedback
- Sqs
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Sqs
Success intFeedback Sample Rate Percentage of success to sample
- Dictionary<string, string>
Key-value map of resource tags
- Application
Failure stringFeedback Role Arn IAM role for failure feedback
- Application
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Application
Success intFeedback Sample Rate Percentage of success to sample
- Arn string
The ARN of the SNS topic, as a more obvious property (clone of id)
- Delivery
Policy string The SNS delivery policy. More on AWS documentation
- Display
Name string The display name for the SNS topic
- Http
Failure stringFeedback Role Arn IAM role for failure feedback
- Http
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Http
Success intFeedback Sample Rate Percentage of success to sample
- Kms
Master stringKey Id 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 stringFeedback Role Arn IAM role for failure feedback
- Lambda
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Lambda
Success intFeedback Sample Rate Percentage of success to sample
- Name string
The friendly name for the SNS topic. By default generated by this provider.
- Name
Prefix string The friendly name for the SNS topic. Conflicts with
name.- Policy string
The fully-formed AWS policy as JSON.
- Sqs
Failure stringFeedback Role Arn IAM role for failure feedback
- Sqs
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- Sqs
Success intFeedback Sample Rate Percentage of success to sample
- map[string]string
Key-value map of resource tags
- application
Failure stringFeedback Role Arn IAM role for failure feedback
- application
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- application
Success numberFeedback Sample Rate Percentage of success to sample
- arn ARN
The ARN of the SNS topic, as a more obvious property (clone of id)
- delivery
Policy string The SNS delivery policy. More on AWS documentation
- display
Name string The display name for the SNS topic
- http
Failure stringFeedback Role Arn IAM role for failure feedback
- http
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- http
Success numberFeedback Sample Rate Percentage of success to sample
- kms
Master stringKey Id 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 stringFeedback Role Arn IAM role for failure feedback
- lambda
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- lambda
Success numberFeedback Sample Rate Percentage of success to sample
- name string
The friendly name for the SNS topic. By default generated by this provider.
- name
Prefix string The friendly name for the SNS topic. Conflicts with
name.- policy string
The fully-formed AWS policy as JSON.
- sqs
Failure stringFeedback Role Arn IAM role for failure feedback
- sqs
Success stringFeedback Role Arn The IAM role permitted to receive success feedback for this topic
- sqs
Success numberFeedback Sample Rate Percentage of success to sample
- {[key: string]: string}
Key-value map of resource tags
- application_
failure_ strfeedback_ role_ arn IAM role for failure feedback
- application_
success_ strfeedback_ role_ arn The IAM role permitted to receive success feedback for this topic
- application_
success_ floatfeedback_ sample_ rate 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_ strfeedback_ role_ arn IAM role for failure feedback
- http_
success_ strfeedback_ role_ arn The IAM role permitted to receive success feedback for this topic
- http_
success_ floatfeedback_ sample_ rate Percentage of success to sample
- kms_
master_ strkey_ id 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_ strfeedback_ role_ arn IAM role for failure feedback
- lambda_
success_ strfeedback_ role_ arn The IAM role permitted to receive success feedback for this topic
- lambda_
success_ floatfeedback_ sample_ rate 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_ strfeedback_ role_ arn IAM role for failure feedback
- sqs_
success_ strfeedback_ role_ arn The IAM role permitted to receive success feedback for this topic
- sqs_
success_ floatfeedback_ sample_ rate Percentage of success to sample
- 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
awsTerraform Provider.