(Originally published elsewhere in 2018), AWS Lambda Logging issue and solution.
AWS Lambda function created via cloudformation doesn’t log
I provisioned new lambda functions via AWS CloudFormation but used an existing service role for lambda execution, however found that no logs were being created. Here’s how to fix.
IAM
Go to the role in IAM, edit the policy and add the resource (the new lambda)
"Resource": [
"Existing...",
"arn:aws:logs:REGION:XXXX:log-group:/aws/lambda/function-name-here:*"
]
Review and apply.
Log group created and contains logs
Immediately after updating the service role policy to add the resource, execute the function and the CloudWatch log group should be created and populated
Originally published elsewhere on 08 July, 2019.