Can't get AWS Lambda function to log (text output) to CloudWatch

后端 未结 15 464
独厮守ぢ
独厮守ぢ 2020-12-13 12:14

I\'m trying to set up a Lambda function that will process a file when it\'s uploaded to an S3 bucket. I need a way to see the output of console.log when I uploa

相关标签:
15条回答
  • 2020-12-13 12:40

    There's a writeup called How to Monitor AWS Lambda with CloudWatch with a section on "How to Use CloudWatch Logs with Lambda". Looks like you already found your answer, but for anybody without the IAM specific issues, this may help.

    0 讨论(0)
  • 2020-12-13 12:43

    After you update your policy, it seems that you have to update your function's settings to refresh all job instances to read new policies.

    So if you just click 'test' button from Lambda console after you update your role policy in IAM, the cached Lambda instances will still have old role permissions, so you will still see no logs being written to Cloudwatch logs.

    Just change your timeout by a second and click on 'save and test' button, and you will start to see logs in Cloudwatch.

    0 讨论(0)
  • 2020-12-13 12:45

    CloudWatch & CloudWatch Logs are different Permissions, you need add CloudWatch Logs to the policy which attached with your role.

    0 讨论(0)
提交回复
热议问题