从CloudFormation创建ConfigurationSetEventDestination时,属性验证失败“ SNSDestination”

时间:2018-11-20 19:10:16

标签: amazon-web-services amazon-cloudformation amazon-sns amazon-ses serverless-framework

我正在尝试使用https://github.com/apache/tomee/blob/master/examples/arquillian-jpa/src/test/java/org/superbiz/arquillian/test/persistence/PersistenceTest.java创建一个ConfigurationSetEventDestination,但是它无法识别EventDestination的值SNSDestination,这是输出。

serverless resources

这里是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'

以下文档enter image description here似乎不可用,但是ConfigurationSetEventDestination EventDestinationhere描述对象一起提供。

从控制台创建时,

SNSDestination也可用

this

@AWS这是怎么回事?

谢谢

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

enter image description here

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

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

[已更新]

我尝试通过nodejs sdk创建相同的文件,它可能起作用,可能是文档https://forums.aws.amazon.com/thread.jspa?messageID=848013&#848013

可以与无服务器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
});

here

2 个答案:

答案 0 :(得分:1)

如果您使用的是serverless框架,我找到了一个解决方案。

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

答案 1 :(得分:0)

我也偶然发现了同一问题,因此,到目前为止,无法使用cloudformation将SNS传递为事件目的地。有关更多信息,请参考link,请签出 NOTE ,此处已明确提及。