New Relic’s AWS CloudFormation integration allows you to add alert conditions to new or existing CloudFormation stacks using the New Relic alerts resource provider. This document explains how to activate and use this integration.
AWS CloudFormation is an Amazon Web Services (AWS) service that allows you to use programming languages or a simple text file to model and provision, in an automated and secure manner, all the resources needed for your applications across all regions and accounts. It allows you to simply create and duplicate a collection of AWS resources, known as a stack. Whenever a stack is generated, AWS CloudFormation provisions the resources that are specified in your template.
Using the CloudFormation integration for New Relic, you can add alert conditions to your CloudFormation template using our custom resource provider, giving you the ability to monitor your infrastructure and applications with New Relic Alerts.
To use the Amazon CloudFormation integration, ensure your system meets these requirements:
- AWS Command Line Interface (AWS CLI) installed.
- New Relic REST API key.
- Optional: CloudFormation CLI installed.
To install the CloudFormation integration:
- Navigate to the New Relic CloudFormation Partner Integration GitHub repository.
- From the repository page, clone or download the repository.
To use private resource providers you must first register them with CloudFormation, in the accounts and regions in which you want to use them. Once you're registered a resource provider, it will appear in the CloudFormation registry for that account and region, and you can use it in your stack templates.
You can register the resource provider using one of the following methods:
Once you have registered the resource, add the
NewRelic::Alerts::NrqlAlert resource to the JSON or YAML file for your CloudFormation stack, using the following properties to configure the alert condition. For an example configuration, see the Lambda CloudFormation resource examples.
The unique ID for the alert policy's account ID associated with the condition; for example,
The name of the alerting condition.
Link to runbook for resolving this error.
The status of your alert condition.
This is the number of groups you expect to see at any given time. It is used in combination with the
If disabled, New Relic looks for a convergence of groups. If the condition is looking for 2 or more groups, and the returned values cannot be separated into that number of distinct groups, then that will also produce a violation. This type of overlap event is represented on a chart by group bands touching.
This is the value function used from the plugin metric, and be one of the following strings:
An array of key/value pairs that may include the following:
The NRQL query being monitored by Alerts, must include both of the following:
Lambda CloudFormation resource examples:
To use the resource provider to provision your stack and create an alert condition:
Once you have added the resource provider to your CloudFormation template, run the following command in your terminal or command-line interface to provision the resource and create your CloudFormation stack:aws cloudformation create-stack --region us-west-2 \--template-body "file://stack.yaml" \--stack-name NewRelicAlert
To view your alert, go to alerts.newrelic.com, select Alert policies > (selected policy) > Alert conditions.
To learn more about using alerts:
- Check out the New Relic University tutorial Intro to alert policies. Or, go directly to the full online course New Relic alerting.
- Read Alerts best practices.
- Learn about the New Relic Alerts API.
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's data security and licenses documentation.