Home > New Relic Agent Installation for Magento on AWS

New Relic Agent Installation for Magento on AWS

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!

From Browsing to Buying: Put Wagento’s eCommerce Mastery to Work for You

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. 

Related Topics

The world of outdoor retail across the globe is evolving and quite rapidly at that. Today, customers want, nay expect, a seamless shopping experience. And

In the ever-evolving world of eCommerce, Magento has remained a go-to platform for retailers who seek robust, scalable solutions. However, the complexity of Magento’s traditional

In the fiercely competitive world of eCommerce, a sturdy platform is akin to an oxygen mask. It is what makes all the difference between scaling

Start Selling with Personalized
eCommerce Solutions