This topic describes how to resolve the issue that the hostname of a Windows Elastic Compute Service (ECS) instance cannot be updated after you change the hostname and restart the instance.
Problem description
On a Windows instance, when you change the hostname and restart the system, the hostname fails to be updated.
View the event logs and check whether error events occurred.
Cause
The issue may be caused by firewall policies that prevent the instance from accessing metadata server
. As a result, the hostname fails to be updated.
Solutions
Add an outbound firewall rule or disable the system firewall to allow the instance to access the metadata server. This resolves the issue caused by the hostname update exception.
Solution 1: Add an outbound firewall rule
Connect to the Windows instance.
For more information, see Connect to a Windows instance by using a password or key.
Open the Windows Defender Firewall with Advanced Security window.
Right-click the icon and select Run.
Enter
wf.msc
in the Run dialog box and click OK.
In the Windows Defender Firewall with Advanced Security window, click Outbound Rules and then click New Rule...
In the New Outbound Rule Wizard dialog box, select Custom and click Scope in the left-side navigation pane.
In the Which remote IP addresses does this rule apply to? section, select These IP addresses: and click Add.
Add the IP address
100.100.100.200
of the metadata server and click OK.In the New Outbound Rule Wizard dialog box, click Action and select Allow the connection.
Click Name in the left-side navigation pane. Specify the name of the outbound firewall rule and click Finish.
Change the hostname and restart the instance. If the hostname is updated as expected, the issue is resolved.
Solution 2: Disable the system firewall
Connect to the Windows instance.
For more information, see Connect to a Windows instance by using a password or key.
Open the Windows Defender Firewall with Advanced Security window.
Right-click the icon and select Run.
Enter
wf.msc
in the Run dialog box and click OK.
In the Windows Defender Firewall with Advanced Security window, click Windows Defender Firewall Properties.
In the Windows Defender Firewall with Advanced Security on Local Computer Properties dialog box, set Firewall state: to Off and click OK.
Check whether the system firewall is disabled.
Change the hostname and restart the instance. If the hostname is updated as expected, the issue is resolved.