Boto3 Guard Duty Put Target 在执行时出错
Boto3 Guard Duty Put Target is having error while executing
我正在为 Cloudwatch 规则创建 boto3,当我使用 client.put_targets 函数时出现以下错误。
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the PutTargets operation: Invalid InputTemplate for target GuardDuty : [Source: (String)"null is in region null"; line: 1, column: 8].
代码如下所示
client.put_targets(Rule='GuardDutyAlarm',
Targets=[{'Id': 'GuardDuty',
'Arn': 'arn:aws:sns:us-west-2:****:GuardDutyAlarmTeams',
'InputTransformer': {
'InputPathsMap': {'severity': '$.detail.severity', 'region': '$.region'},
'InputTemplate': "<severity> is in region <region>"}}])
我们遇到了类似的问题,并且找到了解决方法。
你必须做那样的事情
client.put_targets(Rule='GuardDutyAlarm',
Targets=[{'Id': 'GuardDuty',
'Arn': 'arn:aws:sns:us-west-2:****:GuardDutyAlarmTeams',
'InputTransformer': {
'InputPathsMap': {'severity': '$.detail.severity', 'region': '$.region'},
'InputTemplate': "\" <severity> is in region <region> \"\n" }}])
我正在为 Cloudwatch 规则创建 boto3,当我使用 client.put_targets 函数时出现以下错误。
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the PutTargets operation: Invalid InputTemplate for target GuardDuty : [Source: (String)"null is in region null"; line: 1, column: 8].
代码如下所示
client.put_targets(Rule='GuardDutyAlarm',
Targets=[{'Id': 'GuardDuty',
'Arn': 'arn:aws:sns:us-west-2:****:GuardDutyAlarmTeams',
'InputTransformer': {
'InputPathsMap': {'severity': '$.detail.severity', 'region': '$.region'},
'InputTemplate': "<severity> is in region <region>"}}])
我们遇到了类似的问题,并且找到了解决方法。 你必须做那样的事情
client.put_targets(Rule='GuardDutyAlarm',
Targets=[{'Id': 'GuardDuty',
'Arn': 'arn:aws:sns:us-west-2:****:GuardDutyAlarmTeams',
'InputTransformer': {
'InputPathsMap': {'severity': '$.detail.severity', 'region': '$.region'},
'InputTemplate': "\" <severity> is in region <region> \"\n" }}])