- 最新
- 投票最多
- 评论最多
【以下的回答经过翻译处理】 为了调查这个问题,我设置了与你类似的工作流程:
- 使用与你相同的事件模式,设置EventBridge规则以侦测Config服务中的 "Config Configuration Item Change" 事件。
- 目标是Systems Manager Ops Item。
- 使用输入转换器配置目标,以按照你指定的格式发送数据。
我能够复制你所描述的相同行为:在我的前几个测试中,没有使用输入转换器,Ops项目被正确创建(我只是通过修改安全组来触发规则)。但是,当实施你提供的输入转换器配置时,我遇到了同样的阻碍,Ops项目未被创建,规则报告了一个 "Failed Invocation" 错误。
我在 EventBridge 规则目标上设置了DLQ,并发现 Failed Invocation 是由以下错误引发的:
'ERROR_MESSAGE': {'stringValue': 'Invalid input for target.'}
检查 CreateOpsItem API 的必需参数,原来Ops Items创建失败是因为事件规则传递的参数不符合要求。创建Ops Items需要一组特定的参数,其中一些由你的输入转换器提供,但传递的其余字段不受支持,不适用于CreateOpsItem调用的一部分。
没有输入转换器(Input Transformer,)时,原始事件数据似乎只会作为 "operationalData" 字段传递。但是,在使用输入转换器时,似乎需要指定正确的期望字段。
为了测试这一点,我将输入路径简化为仅包括CreateOpsItem调用的顶级字段所期望的字段。此外,为了确保你可以将其他自定义事件数据作为Ops项目的一部分传递,我使用了其他可变的事件数据作为操作数据键。请注意:操作数据键不能以以下内容开头:amazon、aws、amzn、ssm、/amazon、/aws、/amzn、/ssm,因此我将它们更改为简单的 "account" 和 "region"。
输入路径:
{
"awsAccountId": "$.detail.configurationItem.awsAccountId",
"awsRegion": "$.detail.configurationItem.awsRegion",
"configurationItemCaptureTime": "$.detail.configurationItem.configurationItemCaptureTime",
"detail-type": "$.detail-type",
"messageType": "$.detail.messageType",
"notificationCreationTime": "$.detail.notificationCreationTime",
"region": "$.region",
"resourceId": "$.detail.configurationItem.resourceId",
"resourceType": "$.detail.configurationItem.resourceType",
"resources": "$.resources",
"source": "$.source",
"time": "$.time"
}
输入模版:
{
"title": "Template under ConfigDrift-EC2-Dedup4",
"description": "Configuration Drift Detected.",
"category": "Security",
"source": "EC2",
"severity": "3",
"operationalData": {
"/aws/dedup": {
"type": "SearchableString",
"value": "{\"dedupString\":\"ConfigurationItemChangeNotification\"}"
},
"account": {
"value": "<awsAccountId>"
},
"region": {
"value": "<awsRegion>"
}
}
}
使用这个输入转换器(Input Transformer )配置再次触发规则,Ops Item成功创建,其中包括dedupString作为OpsItem详情,以及通过操作数据字段传递的account和region变量。
如果你希望传递更多原始的自定义字段,而这些字段不是CreateOpsItem调用的顶级字段,你可以像上面所示一样将它们作为自定义操作数据键值对传递。
相关内容
- AWS 官方已更新 1 年前
- AWS 官方已更新 2 年前
- AWS 官方已更新 7 个月前