TopicPolicyProps

class aws_cdk.aws_sns.TopicPolicyProps(*, topics, enforce_ssl=None, policy_document=None)

Bases: object

Properties to associate SNS topics with a policy.

Parameters:
ExampleMetadata:

infused

Example:

topic = sns.Topic(self, "Topic")
policy_document = iam.PolicyDocument(
    assign_sids=True,
    statements=[
        iam.PolicyStatement(
            actions=["sns:Subscribe"],
            principals=[iam.AnyPrincipal()],
            resources=[topic.topic_arn]
        )
    ]
)

topic_policy = sns.TopicPolicy(self, "Policy",
    topics=[topic],
    policy_document=policy_document
)

Attributes

enforce_ssl

Adds a statement to enforce encryption of data in transit when publishing to the topic.

For more information, see https://docs.aws.amazon.com/sns/latest/dg/sns-security-best-practices.html#enforce-encryption-data-in-transit.

Default:

false

policy_document

IAM policy document to apply to topic(s).

Default:

empty policy document

topics

The set of topics this policy applies to.