Skip to content

Instantly share code, notes, and snippets.

@jkras
Created January 2, 2017 23:08
Show Gist options
  • Save jkras/06733834e88be74330a4e9cf6d67af03 to your computer and use it in GitHub Desktop.
Save jkras/06733834e88be74330a4e9cf6d67af03 to your computer and use it in GitHub Desktop.
New Relic Infrastructure Server Config file for AWS Elastic Beanstalk
files:
"/home/ec2-user/new_relic_servers_setup.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
printf "license_key: $NEW_RELIC_LICENSE_KEY" | sudo tee /etc/newrelic-infra.yml
printf "[newrelic-infra]\nname=New Relic Infrastructure\nbaseurl=http://download.newrelic.com/infrastructure_agent/linux/yum/el/6/x86_64\nenable=1\ngpgcheck=0" | sudo tee /etc/yum.repos.d/newrelic-infra.repo
yum -q makecache -y --disablerepo='*' --enablerepo='newrelic-infra'
sudo yum install newrelic-infra -y
container_commands:
set_up:
command: /home/ec2-user/new_relic_servers_setup.sh
@jkras
Copy link
Author

jkras commented Jan 2, 2017

Drop this into your .ebextensions folder, and make sure to set NEW_RELIC_LICENSE_KEY in your elastic beanstalk environment variables.

@aquitania99
Copy link

Legend!

@zhafri-shafiq
Copy link

What about for Amazon Linux 2? Can you suggest the changes? Because I believe that environment values cannot be retrieved from .ebextensions folder/stage anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment