I am trying to put a subscription on a CW log group from a Lambda Function that is scanning for lambdas with the right tag. When calling the put_subscription_filter an Error is thrown:
"An error occurred (InvalidParameterException) when calling the PutSubscriptionFilter
operation: Could not execute the lambda function. Make sure you have given CloudWatch Logs
permission to execute your function."
Stated in the docs for put subscription filter iam:PassRole permission is needed. I have grant this. I have made sure it is not a premission issue for the Lambda function by giving it full admin rights.
By reading the error it indicates it is CW Logs that need permission to execute a function, my guess is that it is the subscribe destination function that they may mean. I have tried a lot of different things here but still no cigar.
Setting a subscription filter in the console is straight forward and no policy is modified or created as I can see.
Does any one have experience of this or any input?