Menu
Amazon Elastic Compute Cloud
User Guide for Windows Instances

Setting the Time for a Windows Instance

A consistent and accurate time reference is crucial for many server tasks and processes. Most system logs include a time stamp that you can use to determine when problems occur and in what order the events take place. If you use the AWS CLI or an AWS SDK to make requests from your instance, these tools sign requests on your behalf. If your instance's date and time are not set correctly, the date in the signature may not match the date of the request, and AWS rejects the request. We recommend that you use Coordinated Universal Time (UTC) for your Windows instances. However, you can use a different time zone if you want.

Changing the Time Zone

Windows instances are set to the UTC time zone by default. you can change the time to correspond to your local time zone or a time zone for another part of your network.

To change the time zone on an instance

  1. From your instance, open a Command Prompt window.

  2. Identify the time zone to use on the instance. To get a list of time zones, use the following command: tzutil /l. This command returns a list of all available time zones, using the following format:

    display name
    time zone ID
  3. Locate the time zone ID to assign to the instance.

  4. Assign the time zone to the instance by using the following command:

    Copy
    tzutil /s "Pacific Standard Time"

    The new time zone should take effect immediately.

Configuring Network Time Protocol (NTP)

Windows instances use the time.windows.com NTP server to configure the system time; however, you can change the instance to use a different set of NTP servers if you need to. For example, if you have Windows instances that do not have Internet access, you can configure them to use an NTP server located within your private network. Your instance's security group must allow outbound UDP traffic on port 123 (NTP). The procedures in this section show how you can verify and change the NTP configuration for an instance.

To verify the NTP configuration

  1. From your instance, open a Command Prompt window.

  2. Get the current NTP configuration by typing the following command:

    Copy
    w32tm /query /configuration

    This command returns the current configuration settings for the Windows instance.

  3. (Optional) Get the status of the current configuration by typing the following command:

    Copy
    w32tm /query /status

    This command returns information such as the last time the instance synced with the NTP server and the poll interval.

To change the NTP configuration

  1. From the Command Prompt window, run the following command:

    Copy
    w32tm /config /manualpeerlist:comma-delimited list of NTP servers /syncfromflags:manual /update

    Where comma-delimited list of NTP servers is the list of NTP servers for the instance to use.

  2. Verify your new settings by using the following command:

    Copy
    w32tm /query /configuration

Configuring Time Settings for Windows Server 2008 and later

When you change the time on a Windows instance, you must ensure that the time persists through system restarts. Otherwise, when the instance restarts, it reverts back to using UTC time. For Windows Server 2008 and later, you can persist your time setting by adding a RealTimeIsUniversal registry key.

To set the RealTimeIsUniversal registry key

  1. From the instance, open a Command Prompt window.

  2. Use the following command to add the registry key:

    Copy
    reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /d 1 /t REG_DWORD /f
  3. If you are using a Windows Server 2008 AMI (not Windows Server 2008 R2) that was created before February 22, 2013, you should verify that the Microsoft hotfix KB2800213 is installed. If this hotfix is not installed, install it. This hotfix resolves a known issue in which the RealTimeIsUniversal key causes the Windows CPU to run at 100% during Daylight savings events and the start of each calendar year (January 1).

    If you are using an AMI running Windows Server 2008 R2 (not Windows Server 2008), you must verify that the Microsoft hotfix KB2922223 is installed. If this hotfix is not installed, install it. This hotfix resolves a known issue in which the RealTimeIsUniversal key prevents the system from updating the CMOS clock.

  4. (Optional) Verify that the instance saved the key successfully using the following command:

    Copy
    reg query "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /s

    This command returns the subkeys for the TimeZoneInformation registry key. You should see the RealTimeIsUniversal key at the bottom of the list, similar to the following:

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation
        Bias                            REG_DWORD     0x1e0
        DaylightBias                    REG_DWORD     0xffffffc4
        DaylightName                    REG_SZ        @tzres.dll,-211
        DaylightStart                   REG_BINARY    00000300020002000000000000000000
        StandardBias                    REG_DWORD     0x0
        StandardName                    REG_SZ        @tzres.dll,-212
        StandardStart                   REG_BINARY    00000B00010002000000000000000000
        TimeZoneKeyName                 REG_SZ        Pacific Standard Time
        DynamicDaylightTimeDisabled     REG_DWORD     0x0
        ActiveTimeBias                  REG_DWORD     0x1a4
        RealTimeIsUniversal             REG_DWORD     0x1

Configuring Time Settings for Windows Server 2003

When you change the time zone on an instance running Windows Server 2003, you must ensure that the time persists through system restarts. Otherwise, if you restart the instance, it reverts to using the UTC clock for your time zone, resulting in a time skew that correlates with your time offset. You can persist your time setting by updating your Citrix PV drivers. For more information, see Upgrading PV Drivers on Your Windows AMI.

After you update the Citrix PV drivers, the Citrix Tools for Virtual Machines Service sets the time on the instance when the service is started.

For more information about how the Windows operating system coordinates and manages time, including the addition of a leap second, see the following topics: