【问题标题】:Property validation failure "SNSDestination" while creating a ConfigurationSetEventDestination from CloudFormation从 CloudFormation 创建 ConfigurationSetEventDestination 时属性验证失败“SNSDestination”
【发布时间】:2019-04-23 07:20:46
【问题描述】:

我正在尝试使用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&#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
});

【问题讨论】:

  • 我现在遇到了完全相同的问题。你找到解决方案了吗?
  • 不,我最终手动创建并使用键名进行渲染,而不是全部在 cloudformation 堆栈中
  • 天哪,太糟糕了。谢谢你的信息!
  • 按照目前的文档,SNS 不能成为 cloudformation 中的目的地。

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


【解决方案1】:

我也偶然发现了同样的问题,所以到目前为止,无法使用 cloudformation 将 SNS 作为事件目的地传递。有关详细信息,请参阅link,请查看 NOTE,其中明确提及。

【讨论】:

    【解决方案2】:

    如果您使用的是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

    【讨论】:

      猜你喜欢
      • 2020-06-03
      • 2019-11-02
      • 2021-04-16
      • 2021-12-06
      • 2020-09-20
      • 2020-08-17
      • 2021-05-31
      • 2012-05-31
      • 1970-01-01
      相关资源
      最近更新 更多