Invalid format for New Relic licence when installing on Elastic Beanstalk

amazon-web-serviceselastic-beanstalkyum

We've created an app that is running on an Elastic Beanstalk instance, 64 bit PHP version 5.4 (so not legacy). I've used the New Relic installation instructions to install New Relic, and viewing phpinfo shows that New Relic is installed.

However, I'm not getting any data in New Relic and that is because it is saying that the licence is ***invalid format*** under newrelic.licence

I'm getting the licence from my New Relic account, and it is a 40 character hexadecimal string. Here is the current newrelic.config file in the .ebextensions folder I'm using, with most of the licence key commented out.

  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: ec9a4...

Skitch of relevant phpinfo

Can anyone shed some light on what's going on here? I've tried two different New Relic licence keys with the same error, I've also surrounded it with a single quote mark and tried uppercase only. And at this point I'm out of ideas on what to try. We're not AWS gurus so it could very easily be something simple like not opening a port to allow the licence to be validated?

Best Answer

I ran into the same issue. Their documentation seems incomplete. A solution is to add this section to your .ebextensions/newrelic.config config file. When you deploy to Beanstalk, this will create a new ini file with your license key that PHP will parse and pick up.

files:
  "/etc/php.d/newrelic.ini":
    mode: "000777"
    owner: ec2-user
    group: ec2-user
    content: |
      newrelic.license="YOUR-NEW-RELIC-LICENSE-KEY-HERE"
Related Topic