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 18, 2018 in AWS by Archana
• 4,170 points
1,553 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,540 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 10, 2020 in AWS by anonymous
11,496 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, 2020 in AWS by anonymous
15,544 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,640 points
6,022 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
23,466 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 8, 2020 in AWS by Shrikant
• 180 points
10,458 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, 2020 in AWS by MD
• 95,460 points
4,178 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 23, 2020 in AWS by MD
• 95,460 points
3,050 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,540 points
53,613 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,540 points
758 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP