下面是我的 palybook.yml 文件的一部分,
- name: "cloudwatch event rule mapping with lambda"
cloudwatchevent_rule:
region: "{{ region }}"
name: "{{ lambda_trigger.events_rule_name }}"
schedule_expression: "{{ lambda_trigger.event_cron_expression }}"
description: "{{ lambda_trigger.events_rule_name }}"
targets:
- id: "{{service_name}}"
arn: "{{ lambda_arn }}"
input_path: {"payload" : "$.detail.{{ lambda_trigger.payload | default({}) }}" }
错误:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: Invalid type for parameter Targets[0].InputPath, value: {'payload': "$.detail.{'queryStringParameters': {'queryName': 'PercentSuccessNoIntervention'}}"}, type: <class 'dict'>, valid types: <class 'str'>
fatal: [localhost]: FAILED! => {"boto3_version": "1.18.14", "botocore_version": "1.21.14", "changed": false, "msg": "Could not create/update rule targets for rule "every-3-minutes: Parameter validation failed:\nInvalid type for parameter Targets[0].InputPath, value: {'payload': \"$.detail.{'queryStringParameters': {'queryName': 'PercentSuccessNoIntervention'}}\"}, type: <class 'dict'>, valid types: <class 'str'>"}