1

I have inherited a large number of undocumented lambdas and I want to know which ones we are and which ones we are not using in our estate. I can collect a list of all of them using aws lambda list-functions, but does not tell me whether they were last called.

Is there an endpoint to the CLI that I could iterate over with the lambda's ARN in order to access this? I have attempted aws cloudwatch get-event-data-store (unsuccessfully). Also not all the lambdas are set up with cloudwatch and there does not seem to be any help in cloudtrail.

Finding the 'last run time' seems like something that people would want to do for a serverless function, but there isn't anything easy about it. Is this possible?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • 1
    CloudTrail is your best bet – jellycsc Jul 25 '22 at 13:41
  • Just for curiosity, why not check on console..? – Riz Jul 25 '22 at 14:25
  • You can use CloudWatch, though not easily through the CLI, it's much more direct to [script](https://gist.github.com/Q726kbXuN/0bb5428a0047830a8118a6fb22bd2b9a) listing the functions and then finding the last invocation within a range. – Anon Coward Jul 25 '22 at 15:23
  • 1
    The AWS Lambda management console has some pretty charts in the **Monitoring** tab that show recent executions. Probably a good place to start! – John Rotenstein Jul 26 '22 at 04:30
  • 1
    @Riz - because there are _a lot_ of lambdas and it seems backwards to click through several sections of GUI each time to get to the relevant CloudWatch/CloudTrail tabs over and over. It just seemed like something that would have been implemented somewhere. – Bev Rivling Jul 26 '22 at 07:11
  • Nice idea @AnonCoward, I will attempt using the boto3 API and create a script, I hadn't considered that! – Bev Rivling Jul 26 '22 at 07:12

0 Answers0