AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

TopicPolicy

The policy for an SNS Topic. Policies define the operations that are allowed on this resource. You almost never need to define this construct directly. All AWS resources that support resource policies have a method called `addToResourcePolicy()`, which will automatically create a new resource policy if one doesn't exist yet, otherwise it will add to the existing policy. Prefer to use `addToResourcePolicy()` instead.

Import

import { TopicPolicy } from 'aws-cdk-lib/aws-sns';

Or use the module namespace:

import * as sns from 'aws-cdk-lib/aws-sns';
// sns.TopicPolicy

Properties

Configuration passed to the constructor as TopicPolicyProps.

topicsRequired
ITopic[]

The set of topics this policy applies to.

enforceSSLOptional
boolean

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

policyDocumentOptional
PolicyDocument

IAM policy document to apply to topic(s).

Default: empty policy document

Get the Amazon SNS Cheat Sheet

Everything you need to know about Amazon SNS on one page. HD quality, print-friendly.

Download Free Infographic