Introduction

Serverless applications are critical for cloud-native customers, and gaining visibility into their functions can take time and effort. This blog post will offer tips and code examples for AWS engineers to help set up serverless monitoring easier with New Relic. We will walk you through a three-tiered application that includes API Gateway, Lambda, and RDS, including tips for instrumenting your serverless functions and debugging strategies for setting up serverless instrumentation using Lambda layers or manual instrumentation in New Relic. Whether you are new to New Relic Serverless monitoring or looking to optimize your existing setup, this post is the perfect guide to achieve your observability goals with New Relic. By the end of this post, you'll have a deeper understanding of serverless computing and equip you with the knowledge and tools to set up serverless instrumentation for AWS quickly.

Why is monitoring your serverless applications important?

Monitoring serverless applications is crucial for identifying and responding to issues, optimizing resource utilization, and improving performance. With serverless architectures, you cannot directly access the underlying infrastructure, so monitoring is essential for detecting problems and taking corrective actions. You can optimize function architecture by monitoring resource usage to minimize usage and adjust allocations to match workload demands. Performance metrics also provide insights into bottlenecks and areas for improvement, such as optimizing code or increasing allocated resources.

Here is a step-by-step guide to setting up New Relic Serverless monitoring in AWS using Lambda layers and manual instrumentation. We will use NodeJS as our language, with Postgres running on AWS RDS.

Prerequisites:

Requirements:

Section 1: Metrics Stream Integration Setup

To start, we recommend installing our AWS Integration to gain valuable insights into your AWS services. To monitor all CloudWatch metrics, we advise installing our Metrics Stream integration, which monitors all metrics from all AWS services, including custom namespaces. Additional integrations can be used to gain extended visibility into key services beyond the available Cloudwatch metrics.

Step 1: AWS Integration Head to New Relic, select InfrastructureAWSSet up AWS Integrations through the UI.