Home > Wagento Way > New Relic Agent Installation for Magento on AWS

New Relic Agent Installation for Magento on AWS

Share:

Grow Your eCommerce

Tell us a little about yourself and we'll guide you through.

"*" indicates required fields

New Relic Agent

Installing a New Relic agent on a server using an advanced continuous deployment tool like Elastic Beanstalk can be a confusing problem to approach. Installation methods found in New Relic documentation and other online resources didn’t work well for this author. New Relic supports so many different technology stacks that you become lost in installation documentation that is not applicable to you. Hopefully, this article can serve as a brief overview of installing New Relic on a LAMP stack appropriate for Magento while using AWS Elastic Beanstalk.

At first, the author mistakenly thought there was only one New Relic agent to install and was encountering multiple ways to install it. Eventually, the realization came that there are two agents: a PHP agent and an infrastructure agent. Both should be installed to get the most out of New Relic. Here are the two configuration files needed to get those agents installed via Elastic Beanstalk.

.ebextensions/new_relic_php.config

<CODE>
packages:
  yum:
    newrelic-php5: []
  rpm:
    newrelic: http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm
commands:
  configure_new_relic:
    command: newrelic-install install
    env:
      NR_INSTALL_SILENT: true
      NR_INSTALL_KEY: <new_relic_key>
files:
  "/etc/php.d/newrelic_custom.ini":
    mode: "000644"
    owner: root
    group: root
    content: |
      [newrelic]
      newrelic.appname = "`{ "Ref" : "AWSEBEnvironmentName" }`"
      newrelic.distributed_tracing_enabled = true
      newrelic.span_events_enabled = true
</CODE>

.ebextensions/new_relic_infrastructure.config

</CODE>
files:
  "/etc/newrelic-infra.yml" :
    mode: "000644"
    owner: root
    group: root
    content: |
      license_key: <new_relic_key>
      enable_process_metrics: true
  "/etc/newrelic-infra/logging.d/discovered.yml" :
    mode: "000644"
    owner: root
    group: root
    content: |
      logs:
        - name: configured-logs-0
          file: /var/log/httpd/*access_log
        - name: configured-logs-1
          file: /var/log/httpd/*error_log
  "/etc/newrelic-infra/logging.d/magento.yml" :
    mode: "000644"
    owner: root
    group: root
    content: |
      logs:
        - name: magento-logs
          file: /var/app/current/var/log/*.log


commands:
# Create the agent’s yum repository
  "01-agent-repository":
    command: sudo curl -o /etc/yum.repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/yum/amazonlinux/2/x86_64/newrelic-infra.repo
#
# Update your yum cache
  "02-update-yum-cache":
    command: yum -q makecache -y --disablerepo='*' --enablerepo='newrelic-infra'
#
# Run the installation script
  "03-run-installation-script":
    command: sudo yum install newrelic-infra -y
</CODE>

This is the author’s first attempt to install New Relic in an environment with PHP using Elastic Beanstalk for deployment. This is a basic configuration, not an advanced one. The essential metrics are ingested by New Relic; transactions and logs, specifically. Hopefully, this article provides clarity on the overall method of installation for New Relic agents and provides an extensible foundation for further tweaks to configuration. Happy tweaking!

Table of Contents

Grow Your eCommerce

"*" indicates required fields

About the Author

Joe Shelton is currently the Head of Development at Wagento Commerce. He worked as a Web Developer at Creative Arc from 2008 to 2015. An Iowa State University alumnus, he holds a degree in Computer Science. 

Talk to a Wagento
Expert Today

Talk to a Wagento
Expert Today

Related Topics

Why Most Magento Stores Struggle After Migration to Magento 2

Migrating from Magento 1 to Magento 2 is a significant step for many online stores. It promises better performance and scalability. However, the transition is not as simple as it seems. Many store owners face unexpected challenges during this process. These issues can range from data migration problems to theme compatibility. The architecture of Magento […]

The Future of Magento in 2026: What the Magento Community Needs to Know

Magento continues to stand strong in 2026 as one of the most flexible and powerful ecommerce platforms in the world. Despite constant competition from SaaS platforms and rapid changes across the ecommerce landscape, the Magento platform remains a top choice for enterprises, manufacturers, retailers, and B2B companies that need complete control, customization, and scalability. This […]

Connect Your Systems, Streamline Operations, and Eliminate Manual Work

Companies across every industry face the same painful reality. Their systems do not talk to each other. Customer data gets trapped inside CRMs. Product data stays stuck inside PIMs. Inventory updates in the ERP but does not sync to the eCommerce platform. Warehouse teams are forced to work with outdated numbers. Finance teams manually reconcile […]