Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Relic Solution: Step-by-step guide to New Relic monitoring of AWS Lambda with video

video
aws-lambda
serverless

#1

Hello all,

It has been some time since the release of AWS Lambda monitoring and I wanted to put this post together to walk you through all the steps that are required to enable New Relic on your Lambda function.

First thing first, if you have missed the announcement and you are wondering, “wait, what New Relic monitors lambda now!!!” then I encourage you to read this blog post from out PM for lambda, Andrew Tunall:

In this post, I have put together a series of videos that walks you through each step of this installation and highlights all the resources you need to get this to work. I have divided these videos into five short videos so you can only watch the ones that you are curious about. I will split these videos into three sections that align with the three steps you need to follow to enable New Relic on your function. With no further ado, let’s jump right in!!!

Step 1. Configure AWS to communicate with New Relic

We are going to start this video from New Relic One homepage using https://one.newrelic.com, once you navigate to this page we will be using the steps mentioned in the GitHub repository below. Keep in mind these steps are the same as the ones mentioned in our public document:

  1. In this video we are going over the Installation steps:

This is the community post that I referenced during the video regarding AWS permissions:

Note: On the setup page for this step, there is a checkbox that is labeled I will connect a new AWS account, I wanted to expand on the usage of this box:

  • If Unchecked: You will be able to use the AWS accounts that you have already integrated with New Relic.
  • If Checked: This will not give you a dropdown option to choose from the AWS accounts that you have previously integrated with New Relic. Therefore, you need to type the name of the new AWS account.
  1. This video will follow the steps to Enable Lambda Integration:

This first step is connecting your AWS account to New Relic, therefore you will be able to see your function appearing in New Relic UI; however, you will see that this function has an empty section under Instrumented. See below screenshot:

On the other hand, you will still see the CloudWatch metrics being reported to New Relic after only completing this step. Refer to the screenshot:

Keep in mind that the section that is labeled Troubleshoot will not have any data until you complete step two and three of this installation. If you click on those tabs you will see the message below:

Step 2. Instrument Lambda code

For this section, we wrote a very simple Hello World lambda function in Node JS that we are going to instrument. This section is also divided into two videos:

  1. The third video will demonstrate how to install the New Relic agent and instrument your function:

  1. Now we will walk you through the AWS UI and setting up environment variables:

Note: During the video I mentioned that there are two required environment variables that you need to set for the Node JS agent; while this statement is true, to receive Distributed Tracing and Invocation Detail data, you need further environment variables. Please see the screenshot below which I extracted from the documentation I followed during the video:

Step 3. Configure CloudWatch logs to stream to New Relic Lambda

Let me first emphasize that this step is required and if you already have one log stream for your function, please contact New Relic Support so we can explore other avenues.

  1. This step consists of only one video where we are going to run the script that links your Lambda function’s CloudWatch Logs stream to the New Relic log-ingestion:

Now that you are all done with these three steps, you can see that your function is shown as instrumented, see below:

Lastly, as I mentioned in the last video you can now see data under the Troubleshoot section, see below:

Closing Notes

While in this post we used a Node JS New Relic agent to instrument our Lambda Function, there are a lot of similarities between different language agents. Therefore, you may still find these videos helpful for other language agents.

Enabling New Relic on AWS (step 1) and the configuring your CloudWatch logs (step 3) are universal among all of the language agents that New Relic supports for Lambda; hence, you only need to use the documentation for that particular language agent to instrument your function code.

Lastly, I have also written this FAQ for Lambda that might answer some of the questions you may come across:

I hope these videos help you get the most out of New Relic monitoring for Lambda and if you have any questions, be sure to comment and we’d do our best to address them. :slight_smile: