How to link AWS Lambda function to Amazon CloudWatch ?

0 votes

I have set up a Lambda function which will process a file as soon as it is uploaded to an S3 bucket. I need a way to see the output of console.log when I upload a file, but I can't figure out how to link my Lambda function to CloudWatch.

By looking at the context object i figured out my log group is /aws/lambda/wavToMp3 and the log stream is 2018/05/23/[$LATEST]hex_code_redacted. So I created that group and stream in CloudWatch, yet nothing is being logged to it.

I don’t know what the error is.

Jul 17, 2018 in AWS by Archana
• 4,090 points
119 views

1 answer to this question.

0 votes
In order to create Log Group and Log Stream Lambda execution role needs to have set of permissions enabled.
{
    "Statement": [
        {
            "Action": [
                "logs:CreateLogGroup",
                 "logs:CreateLogStream",
                 "logs:PutLogEvents"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:logs:*:*:*"
        }
    ]
} 
Once the necessary permissions are set it should work properly. You can check out AWS Documentation on Lambda function for more details.
answered Jul 20, 2018 by datageek
• 2,440 points

Related Questions In AWS

0 votes
1 answer

how to import numpy and pandas inside aws lambda function?

The problem is that your local numpy ...READ MORE

answered Sep 14, 2018 in AWS by Priyaj
• 56,160 points
1,852 views
0 votes
1 answer

How do I add python libraries to an AWS lambda function for Alexa?

As it is described in the Amazon ...READ MORE

answered Oct 23, 2018 in AWS by Archana
• 4,090 points
181 views
0 votes
1 answer

How to invoke the AWS lambda function from Java code

There are 2 methods in this class which should ...READ MORE

answered Feb 19 in AWS by Archana
• 5,480 points
361 views
0 votes
2 answers

How to kill a lambda function in AWS?

$ aws lambda put-function-concurrency --function-name my-function --reserved-concurrent-executions ...READ MORE

answered Mar 28 in AWS by Shashank
• 1,350 points
272 views
+1 vote
3 answers

Not able to pass params POST to AWS Lambda from Amazon API Gateway

For this template : application/x-www-form-urlencoded  This line below will ...READ MORE

answered Jun 13, 2018 in AWS by Cloud gunner
• 4,260 points
1,674 views
0 votes
1 answer
0 votes
1 answer

How to get AWS account/service cost using CloudWatch API?

You can check this link for a ...READ MORE

answered Jul 13, 2018 in AWS by Priyaj
• 56,160 points
139 views
0 votes
1 answer

How to list the contents of Amazon S3 by modified date?

One easy solution would be probably to ...READ MORE

answered Aug 21, 2018 in AWS by datageek
• 2,440 points
2,948 views
+1 vote
2 answers

AWS Lambda Function Issues

If you have created AWS Lambda Deployment JAR ...READ MORE

answered Sep 14, 2018 in AWS by datageek
• 2,440 points
45 views