Ansible Cloudwatch rule reports failed invocations

前端 未结 3 1356
长发绾君心
长发绾君心 2021-02-13 07:15

I have created an AWS lambda that works well when I test it and when I create a cron job manually through a cloudwatch rule.

It reports metrics as invocations (not faile

3条回答
  •  后悔当初
    2021-02-13 07:57

    To extend the answered here https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CWE_Troubleshooting.html#LAMfunctionNotInvoked. Since you are creating it via API you should add permission to Lambda as mentioned before. Without compromising security you could do the following:

    Add rule with PutRule api call, it will return you

    {
       "RuleArn": "string"
    }
    

    Use the RuleArn in Lambda AddPermission call

    aws lambda add-permission \
    --function-name MyFunction \
    --statement-id MyId \
    --action 'lambda:InvokeFunction' \
    --principal events.amazonaws.com \
    --source-arn arn-from-PutRule-request
    

提交回复
热议问题