我正在尝试使用 serverless resources 创建一个 ConfigurationSetEventDestination
但它无法识别 EventDestination
的值 SNSDestination
,这是输出。
这里是来自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
@AWS 这是怎么回事?
谢谢
PS:我不是唯一一个......
https://forums.aws.amazon.com/thread.jspa?messageID=858616󑧸
https://forums.aws.amazon.com/thread.jspa?messageID=809004󅠬
https://forums.aws.amazon.com/thread.jspa?messageID=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
});
最佳答案
如果您使用无服务器
框架,我找到了一个解决方案。
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
关于amazon-web-services - 从 CloudFormation 创建 ConfigurationSetEventDestination 时属性验证失败 "SNSDestination",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53399929/