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

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

我正在尝试使用 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/

相关文章:

python - 无法使用 python -m 调用工具执行

amazon-web-services - 如何从 ami 镜像跟踪新启动的 ec2 实例?

java - 启用 RawMessageDelivery 时的 Amazon SNS 通知验证

amazon-web-services - 无法通过 EC2 实例中的公共(public) IP 访问我的 Elasticsearch

java - 如何避免为未实现公共(public)接口(interface)的相同库方法编写许多包装器?

c# - 使用 .NET Core 应用程序优雅地处理 AWS ECS 停止任务

amazon-web-services - 连接ImportValue和参数存储值

amazon-web-services - 云形成 : Deleting an entire nested stack

java - Sns @NotificationMessage 不适用于 String 以外的类型

mysql - Eloquent 使用远程 MySQL DB 花费的时间太长