This can be achieved by setting the InstanceRunCommand to execute a script that will setup the agent when the EC2 instance boots:
convox rack params set InstanceRunCommand="curl https://user:pass@some-private-server/instance-run-command.sh | sh"
instance-run-command.sh script being as follows:
echo "license_key: KEY" | tee -a /etc/newrelic-infra.yml
curl -o /etc/yum.repos.d/newrelic-infra.repo \
yum -q makecache -y --disablerepo='*' --enablerepo='newrelic-infra'
yum install newrelic-infra -y
You could also pass the whole thing as the value for the
InstanceRunCommand param, but it’s easier to manage as a separate script. If you assign an
InstancePolicy in the rack params, you could also probably fetch it from S3 without the need to authenticate.