AWS SES Configset-无法使用AWS云形成堆栈为SNS创建事件目标

时间:2018-08-05 15:49:45

标签: amazon-web-services amazon-cloudformation amazon-sns amazon-ses amazon-simple-email-service

我似乎无法使用AWS Cloud Formation堆栈创建新的AWS SES配置集。错误显示“ YAML格式不正确”

以下是我的CF堆栈的json模板:

"Resources" : {
"ConfigSet": {
    "Type": "AWS::SES::ConfigurationSet",
    "Properties": {
        "Name": "CS_EMAIL_TRACKING"
    }
},
"CWEventDestination": {
    "Type": "AWS::SES::ConfigurationSetEventDestination",
    "Properties": {
        "ConfigurationSetName": "CS_EMAIL_TRACKING",
        "EventDestination": {
            "Name": "CS_EMAIL_TRACKING_CW_DESTINATION",
            "Enabled": true,
            "MatchingEventTypes": ["bounce", "complaint", "delivery", "open", "reject", "renderingFailure", "send"],
            "CloudWatchDestination": {
                "DimensionConfigurations": [{
                    "DimensionName": "AGS",
                    "DimensionValueSource": "messageTag",
                    "DefaultDimensionValue": "MY_AGS"
                }, {
                    "DimensionName": "Component",
                    "DimensionValueSource": "messageTag",
                    "DefaultDimensionValue": "Mail"
                }, {
                    "DimensionName": "ses:caller-identity",
                    "DimensionValueSource": "messageTag",
                    "DefaultDimensionValue": "shouldbeautoset"
                }]
            }
        }
    }
},
"SNSEventDestination": {
    "Type": "AWS::SES::ConfigurationSetEventDestination",
    "Properties": {
        "ConfigurationSetName": "CS_EMAIL_TRACKING",
        "EventDestination": {
            "Name": "CS_EMAIL_TRACKING_SNS_DESTINATION",
            "Enabled": true,
            "MatchingEventTypes": ["bounce", "complaint", "delivery", "reject", "send"],
            "SNSDestination": {
                "TopicARN": "arn:aws:sns:us-east-1:99999999:SES-STATUS_TRACKING_TOPIC"
            }
        }
    }
}

}

上面的json对我来说不错,但是...

有人可以帮忙吗?我想念什么吗?

谢谢!

编辑:我让堆栈使用了参数。现在,尽管我面临的另一个问题是SNSDestination是EventDestination。 即使AWS文档说它是有效的属性,它也会说EventDestination的不受支持属性:

下面是我的最终代码:

{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS SES ConfigurationSet ${CRED_AGS} Template",
"Parameters": {
    "ConfigSetName": {
        "Type" : "String",
        "Default" : "${CONFIGSET_NAME}"
    },
    "EventCWDestinationName" : {
        "Type" : "String",
        "Default" : "${CW_DESTINATION_NAME}"
    },
    "EventSNSDestinationName" : {
        "Type" : "String",
        "Default" : "${SNS_DESTINATION_NAME}"
    },
    "EventTypeBounce" : {
        "Type" : "String",
        "Default" : "bounce"
    },
    "EventTypeComplaint" : {
        "Type" : "String",
        "Default" : "complaint"
    },
    "EventTypeDelivery" : {
        "Type" : "String",
        "Default" : "delivery"
    },
    "EventTypeOpen" : {
        "Type" : "String",
        "Default" : "open"
    },
    "EventTypeReject" : {
        "Type" : "String",
        "Default" : "reject"
    },
    "EventTypeRenderingFailure" : {
        "Type" : "String",
        "Default" : "renderingFailure"
    },
    "EventTypeSend" : {
        "Type" : "String",
        "Default" : "send"
    },
    "DimensionValueSourceMsgTag" : {
        "Type" : "String",
        "Default" : "messageTag"
    },
    "DimensionNameAGS" : {
        "Type" : "String",
        "Default" : "AGS"
    },
    "DefaultDimensionValueAGS" : {
        "Type" : "String",
        "Default" : "${CRED_AGS}"
    },
    "DimensionNameComponent" : {
        "Type" : "String",
        "Default" : "Component"
    },
    "DefaultDimensionValueComponent" : {
        "Type" : "String",
        "Default" : "Mail"
    },
    "DimensionNameIdentity" : {
        "Type" : "String",
        "Default" : "ses:caller-identity"
    },
    "DefaultDimensionValueIdentity" : {
        "Type" : "String",
        "Default" : "shouldbeautoset"
    }
},
"Resources": {
    "ConfigSet" : {
        "Type" : "AWS::SES::ConfigurationSet",
        "Properties" : {
            "Name" : {
                "Ref" : "ConfigSetName"
            }
        }
    },
    "CWEventDestination" : {
        "Type" : "AWS::SES::ConfigurationSetEventDestination",
        "Properties" : {
            "ConfigurationSetName" : {
                "Ref": "ConfigSetName"
            },
            "EventDestination" : {
                "Name" : {
                    "Ref" : "EventCWDestinationName"
                },
                "Enabled" : true,
                "MatchingEventTypes" : [
                    {
                        "Ref" : "EventTypeBounce"
                    },
                    {
                        "Ref" : "EventTypeComplaint"
                    },
                    {
                        "Ref" : "EventTypeDelivery"
                    },
                    {
                        "Ref" : "EventTypeOpen"
                    },
                    {
                        "Ref" : "EventTypeReject"
                    },
                    {
                        "Ref" : "EventTypeRenderingFailure"
                    },
                    {
                        "Ref" : "EventTypeSend"
                    }
                ],
                "CloudWatchDestination" : {
                    "DimensionConfigurations" : [
                        {
                            "DimensionName" : {
                                "Ref" : "DimensionNameAGS"
                            },
                            "DimensionValueSource" : {
                                "Ref" : "DimensionValueSourceMsgTag"
                            },
                            "DefaultDimensionValue" : {
                                "Ref": "DefaultDimensionValueAGS"
                            }
                        },
                        {
                            "DimensionName" : {
                                "Ref" : "DimensionNameComponent"
                            },
                            "DimensionValueSource" : {
                                "Ref" : "DimensionValueSourceMsgTag"
                            },
                            "DefaultDimensionValue" : {
                                "Ref" : "DefaultDimensionValueComponent"
                            }
                        },
                        {
                            "DimensionName" : {
                                "Ref" : "DimensionNameIdentity"
                            },
                            "DimensionValueSource" : {
                                "Ref" : "DimensionValueSourceMsgTag"
                            },
                            "DefaultDimensionValue" : {
                                "Ref" : "DefaultDimensionValueIdentity"
                            }
                        }
                    ]
                }
            }
        }
    },
    "SNSEventDestination" : {
        "Type" : "AWS::SES::ConfigurationSetEventDestination",
        "Properties" : {
            "ConfigurationSetName" : {
                "Ref": "ConfigSetName"
            },
            "EventDestination" : {
                "Name" : {
                    "Ref" : "EventSNSDestinationName"
                },
                "Enabled" : true,
                "MatchingEventTypes" : [
                    {
                        "Ref" : "EventTypeBounce"
                    },
                    {
                        "Ref" : "EventTypeComplaint"
                    },
                    {
                        "Ref" : "EventTypeDelivery"
                    },
                    {
                        "Ref" : "EventTypeReject"
                    },
                    {
                        "Ref" : "EventTypeSend"
                    }
                ],
                "SNSDestination" : {
                    "TopicARN" : "${SNS_DELIVERY_TOPIC}"
                } 
            }
        }
    }
}

}

有人可以帮忙吗?顺便说一句,我有最新的AWS CLI。

1 个答案:

答案 0 :(得分:0)

我认为现在不支持 SNSDestination。当您设置配置集时,它可能默认存在