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,150 points
641 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,500 points

Related Questions In AWS

0 votes
2 answers

how to import numpy and pandas inside aws lambda function?

this approach worked for me: https://medium.com/@melissa_89553/how-to- ...READ MORE

answered Oct 9 in AWS by anonymous
5,884 views
0 votes
2 answers
0 votes
2 answers

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

If you get lucky (it depends what ...READ MORE

answered Nov 3 in AWS by anonymous
7,586 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, 2019 in AWS by Archana
• 5,600 points
3,485 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, 2019 in AWS by Shashank
• 1,370 points
11,907 views
0 votes
3 answers

How to check instance state and status via Lambda function in AWS?

import boto3 from pprint import pprint def lambda_handler(event, context):          # ...READ MORE

answered Sep 7 in AWS by Shrikant
• 180 points
1,685 views
0 votes
1 answer

How to setup an alarm when Lambda function fails in AWS?

Hi@akhtar, To create an Alarm for Lambda function, ...READ MORE

answered Apr 2 in AWS by MD
• 80,750 points
379 views
0 votes
1 answer

How to update aws lambda function using aws cli?

Hi@akhtar, You can update your Lambda function in ...READ MORE

answered Sep 22 in AWS by MD
• 80,750 points
265 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,500 points
21,611 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,500 points
104 views