I'm running an AWS python lambda on a trigger and would like to monitor it using cloudwatch. I'm monitoring cloudwatch "invocations" and "errors" but the are always the same.
What do I need to do in python when the lambda returns so that cloud watch will recognise it as a success/error.
The data that is passed to the lambda will sometimes be poorly formatted and will not be able to be processed - I'd like to return an error at that point that will be recognised by cloudwatch.
I've tried the following but the errors and invocations count is always the same.
return '{"statusCode": 200,"body": "OK"}'
return '{"StatusCode": 200,"body": "OK"}'
return '{"statusCode": 500,"body": "Error"}'
return '{"StatusCode": 500,"body": "Error"}'
What am I missing not understanding?
Yeah my bad, you might be looking for api gateway logging to cloudwatch. AWS has a great walkthrough on how to do that. https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-cloudwatch-logs/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.