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

后端 未结 15 517
独厮守ぢ
独厮守ぢ 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:29

    For the lambda function to create log stream and publish logs to cloudwatch, the lambda execution role needs to have the following permissions.

    {
        "Statement": [
            {
                "Action": [
                    "logs:CreateLogGroup",
                     "logs:CreateLogStream",
                     "logs:PutLogEvents"
                ],
                "Effect": "Allow",
                "Resource": "arn:aws:logs:*:*:*"
            }
        ]
    } 
    

    Please refer to the following AWS documentation for more details http://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html#lambda-intro-execution-role

提交回复
热议问题