Automatically installing New Relic on Elastic Beanstalk
Nearly 100% automated - it looks like the only way to grab an environment variable right now is through some nasty hacks.
Other than the one hard-coded thing at the moment, this seems to work well. Sets up the New Relic configuration as desired, on instance creation. Assuming stock PHP 5.x Amazon Linux AMI.
Just drop this in .ebextensions/newrelic.config
or something of the sort, and rebuild your environment. Replace API_KEY with your API key, and change or remove the newrelic.framework line if not using WordPress (this page has a list of supported frameworks)
packages: yum: newrelic-sysmond: [] newrelic-php5: [] rpm: newrelic: http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm commands: "01_configure_sysmond": command: nrsysmond-config --set license_key=API_KEY "02_start_sysmond": command: /etc/init.d/newrelic-sysmond start "03_install_php_agent": command: newrelic-install install env: NR_INSTALL_SILENT: true NR_INSTALL_KEY: API_KEY files: "/etc/php.d/newrelic.ini": mode: "000644" owner: root group: root content: | extension=newrelic.so [newrelic] newrelic.appname = "`{ "Ref" : "AWSEBEnvironmentName" }`" newrelic.browser_monitoring.auto_instrument = true newrelic.capture_params = true newrelic.enabled = true newrelic.error_collector.enabled = true newrelic.error_collector.record_database_errors = true newrelic.high_security = false newrelic.license = "API_KEY" newrelic.transaction_tracer.detail = 1 newrelic.transaction_tracer.enabled = true newrelic.transaction_tracer.explain_enabled = true newrelic.transaction_tracer.explain_threshold = 2000 newrelic.transaction_tracer.record_sql = "raw" newrelic.transaction_tracer.slow_sql = true newrelic.framework = "wordpress"