gpt4 book ai didi

amazon-web-services - 从 CloudFormation 创建 ConfigurationSetEventDestination 时属性验证失败 "SNSDestination"

转载 作者:行者123 更新时间:2023-12-02 04:27:15 25 4
gpt4 key购买 nike

我正在尝试使用 serverless resources 创建一个 ConfigurationSetEventDestination但它无法识别 EventDestination 的值 SNSDestination,这是输出。

enter image description here

这里是来自serverless.yml的资源

resources:
Resources:
HandleEmailsEvents:
Type: AWS::SNS::Topic
Properties:
DisplayName: 'Handle emails events (${self:custom.stage})'
TopicName: 'HandleEmailsEvents'
ConfigurationSet:
Type: 'AWS::SES::ConfigurationSet'
Properties:
Name: 'EMAIL_TRACKING'
ConfigurationSetEventDestination:
Type: 'AWS::SES::ConfigurationSetEventDestination'
Properties:
ConfigurationSetName: 'EMAIL_TRACKING'
EventDestination:
Name: 'EMAIL_TRACKING_DESTINATION'
Enabled: true
MatchingEventTypes:
- bounce
- complaint
SNSDestination:
TopicARN:
Ref: 'HandleEmailsEvents'

遵循文档 ConfigurationSetEventDestination EventDestination似乎不可用,但是here它与 this描述对象。

从控制台创建时也可以使用 SNSDestination

enter image description here

@AWS 这是怎么回事?

谢谢

PS:我不是唯一一个......

https://forums.aws.amazon.com/thread.jspa?messageID=858616&#858616

https://forums.aws.amazon.com/thread.jspa?messageID=809004&#809004

https://forums.aws.amazon.com/thread.jspa?messageID=848013&#848013

[已更新]

我尝试通过nodejs sdk创建相同的内容,它有效,有可能,文档here .

可能是无服务器 CloudFormation 生成的堆栈吗?

let ses = new AWS.SES()
const destinationParams = {
ConfigurationSetName: 'test',
EventDestination: {
Name: 'xxxxx2',
MatchingEventTypes: ['send', 'reject', 'bounce', 'complaint', 'delivery', 'open', 'click'],
Enabled: true,
SNSDestination: {
TopicARN: 'arn:aws:sns:us-east-1:xxxxxxxxxx:test',
},
},
};

ses.createConfigurationSetEventDestination(destinationParams, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});

enter image description here

最佳答案

如果您使用无服务器框架,我找到了一个解决方案。

1- 创建资源以在 serverless.yml 中创建 ConfigurationSet

resources:
Resources:
ConfigurationSet:
Type: 'AWS::SES::ConfigurationSet'
Properties:
Name: 'EMAIL_TRACKING'

2-安装serverless-ses-sns

npm install --save-dev serverless-ses-sns

3-添加到serverless.yml

plugins:
- serverless-ses-sns

4-最后在serverless.yml中添加配置

custom:
snsDestination:
region: <region> # If absent, self:provider.region will be used
configurationSet: 'EMAIL_TRACKING'
topicArn: <topic arn> # If absent, one will be created
events: # One or more of the following
- renderingFailure
- reject
- bounce
- send
- complaint
- delivery
- open
- click

Reference for the plugin

关于amazon-web-services - 从 CloudFormation 创建 ConfigurationSetEventDestination 时属性验证失败 "SNSDestination",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53399929/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com