如何在AWS CDK中为SES身份配置退信通知SNS主题?
问题:如何通过CDK TypeScript将SNS主题关联到SES身份以接收退信通知?
以下是我用于创建SES身份和SNS主题的CDK TypeScript代码片段:
toolsAccountSES = new EmailIdentity(this, 'ToolsSESidentity', { identity: Identity.publicHostedZone(hostedZone), }); // 设置退信通知 const bounceTopic = new Topic(this, `ses-bounce-${props.branchName}`, { topicName: `ses-bounce-${props.branchName}`, displayName: `SES bounce notifications for ${props.branchName}`, }); bounceTopic.addSubscription(new EmailSubscription(bounceEmail))
是否有办法将该主题关联到SES身份以接收退信通知?我在CDK中未找到实现方式。
更新:尝试的解决方案代码
我创建了一个用于生成配置集的Construct:
export class sesConfig extends Construct { public configurationSet: ConfigurationSet; constructor(scope: Construct, id: string) { super(scope, id); const bounceTopic = new Topic(this, 'bounce-topic'); bounceTopic.addSubscription(new EmailSubscription(bounceEmail)); this.configurationSet = new ConfigurationSet(this, 'ses-config'); this.configurationSet.addEventDestination('bounce-destination', { destination: EventDestination.snsTopic(bounceTopic), events: [EmailSendingEvent.BOUNCE], }); } }
并在创建电子邮件身份时将其传入构造函数:
new EmailIdentity(scope, 'SubdomainIdentity', { identity: Identity.publicHostedZone(hostedZone), configurationSet: new sesConfig(scope, 'ses-config').configurationSet, });
电子邮件身份和SNS主题已成功创建,但在控制台查看该身份时,未显示任何通知设置。

内容的提问来源于stack exchange,提问作者Comfortably Numb
相关产品推荐
相关产品推荐

