- Newest
- Most votes
- Most comments
To configure Amazon SES feedback notifications (bounce, complaint, delivery) to SNS topics using AWS CDK with TypeScript, you can use the CfnConfigurationSetEventDestination construct from the aws-cdk-lib/aws-ses module.
Here's how to set it up:
- First, create a configuration set and an SNS topic:
import * as cdk from 'aws-cdk-lib'; import * as ses from 'aws-cdk-lib/aws-ses'; import * as sns from 'aws-cdk-lib/aws-sns'; import { Construct } from 'constructs'; export class SesNotificationsStack extends cdk.Stack { constructor(scope: Construct, id: string, props?: cdk.StackProps) { super(scope, id, props); // Create an SNS topic for SES notifications const notificationTopic = new sns.Topic(this, 'SesNotificationTopic'); // Create a configuration set const configSet = new ses.CfnConfigurationSet(this, 'EmailConfigSet', { name: 'my-email-config-set', }); // Create an event destination for the configuration set new ses.CfnConfigurationSetEventDestination(this, 'EventDestination', { configurationSetName: configSet.name, eventDestination: { name: 'sns-destination', enabled: true, matchingEventTypes: [ 'BOUNCE', 'COMPLAINT', 'DELIVERY' ], snsDestination: { topicArn: notificationTopic.topicArn } } }); } }
- The key parts of this configuration are:
- Creating an SNS topic that will receive the notifications
- Creating a SES configuration set
- Setting up an event destination that connects the configuration set to the SNS topic
- Specifying which event types to capture (BOUNCE, COMPLAINT, DELIVERY)
- After deploying this stack, you'll need to:
- Subscribe endpoints to the SNS topic to receive the notifications
- When sending emails through SES, specify the configuration set name in your email sending parameters
The notifications will be delivered to your SNS topic in JSON format, containing information about the original email and the specific event details (bounce, complaint, or delivery information).
Remember that standard Amazon SNS rates apply for these notifications.
Sources
Amazon SES notifications sent through Amazon SNS - Amazon Simple Email Service
interface EventDestinationProperty · AWS CDK
Configuring Amazon SNS notifications for Amazon SES - Amazon Simple Email Service
answered a year ago
This is a configuration setup. I only want to configure the SES Feedback Notifications tab using CDK with TypeScript. The SES Feedback Notifications tab is configured to send events (such as bounces or complaints) to the SNS topic, which then triggers the Lambda function
answered a year ago
Relevant content
asked 5 months ago
- AWS OFFICIALUpdated a year ago
