No, I’m not having much luck on my side.
I’ll share what I have in my newrelic.config that is in the ebextensions folder. I’m able to install the new relic agent, just working on getting the hostnamed change.
Talking with Amazon support, I have to restart the instance which I’m working on. Also, trying to get logging working so that I can see and verify the hostname change.
newrelic.config
files:
"c:\\newrelic\\newrelic_agent.msi":
source: {0}
"c:\\init_scripts\\change_hostname_in_config.ps1":
content: |
Write-Eventlog -LogName Application -Source Ec2Config -EventId 1000 -EntryType Information -Message ""Changing hostname""
$newHostName = $(invoke-restmethod -uri http://169.254.169.254/latest/meta-data/hostname).Split(".") | select -First 1
Write-Eventlog -LogName Application -Source Ec2Config -EventId 1000 -EntryType Information -Message $(""Pre .NET GetHostName: "" + $([System.Net.Dns]::GetHostName()))
Write-Eventlog -LogName Application -Source Ec2Config -EventId 1000 -EntryType Information -Message $(""Expected HostName: "" + $newHostName)
Rename-Computer -Force -NewName $newHostName
Write-Eventlog -LogName Application -Source Ec2Config -EventId 1000 -EntryType Information -Message $(""Post.NET GetHostName: "" + $([System.Net.Dns]::GetHostName()))
commands:
01_change_hostname:
command: powershell.exe -ExecutionPolicy Bypass -Command "c:\\init_scripts\\change_hostname_in_config.ps1"
waitAfterCompletion: 0
02_install_newrelic_agent:
command: msiexec.exe /i c:\\newrelic\\newrelic_agent.msi /q NR_LICENSE_KEY={1} INSTALLLEVEL=50
waitAfterCompletion: 0
EDITED: Updated with EventLogging that will show in logs