aws-cdk-lib.aws_events_targets.SnsTopicProps

interface SnsTopicProps

LanguageType name
.NETAmazon.CDK.AWS.Events.Targets.SnsTopicProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awseventstargets#SnsTopicProps
Javasoftware.amazon.awscdk.services.events.targets.SnsTopicProps
Pythonaws_cdk.aws_events_targets.SnsTopicProps
TypeScript (source)aws-cdk-lib » aws_events_targets » SnsTopicProps

Customize the SNS Topic Event Target.

Example

declare const onCommitRule: events.Rule;
declare const topic: sns.Topic;

onCommitRule.addTarget(new targets.SnsTopic(topic, {
  message: events.RuleTargetInput.fromText(
    `A commit was pushed to the repository ${codecommit.ReferenceEvent.repositoryName} on branch ${codecommit.ReferenceEvent.referenceName}`
  )
}));

Properties

NameTypeDescription
deadLetterQueue?IQueueThe SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue.
maxEventAge?DurationThe maximum age of a request that Lambda sends to a function for processing.
message?RuleTargetInputThe message to send to the topic.
retryAttempts?numberThe maximum number of times to retry when the function returns an error.

deadLetterQueue?

Type: IQueue (optional, default: no dead-letter queue)

The SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue.

The events not successfully delivered are automatically retried for a specified period of time, depending on the retry policy of the target. If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.


maxEventAge?

Type: Duration (optional, default: Duration.hours(24))

The maximum age of a request that Lambda sends to a function for processing.

Minimum value of 60. Maximum value of 86400.


message?

Type: RuleTargetInput (optional, default: the entire EventBridge event)

The message to send to the topic.


retryAttempts?

Type: number (optional, default: 185)

The maximum number of times to retry when the function returns an error.

Minimum value of 0. Maximum value of 185.