Change the time zone of your instance - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Change the time zone of your instance

Amazon EC2 instances are set to the UTC (Coordinated Universal Time) time zone by default. You can change the time on an instance to the local time zone or to another time zone in your network.

Use the instructions for your instance's operating system.

Important

This information applies to Amazon Linux. For information about other distributions, see their specific documentation.

To change the time zone on an AL2023 or Amazon Linux 2 instance
  1. View the system's current time zone setting.

    [ec2-user ~]$ timedatectl
  2. List the available time zones.

    [ec2-user ~]$ timedatectl list-timezones
  3. Set the chosen time zone.

    [ec2-user ~]$ sudo timedatectl set-timezone America/Vancouver
  4. (Optional) Confirm that the current time zone is updated to the new time zone by running the timedatectl command again.

    [ec2-user ~]$ timedatectl
To change the time zone on a Windows 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 in the following format:

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

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

    tzutil /s "Pacific Standard Time"

    The new time zone should take effect immediately.

Note

You can assign the UTC time zone by using the following command:

tzutil /s "UTC"

To prevent your time zone from changing once you set it for Windows Server

When you change the time zone on a Windows instance, you must ensure that the time zone persists through system restarts. Otherwise, when the instance restarts, it reverts back to using UTC time. You can persist your time zone setting by adding a RealTimeIsUniversal registry key. This key is set by default on all current generation instances. To verify whether the RealTimeIsUniversal registry key is set, see step 4 in the following procedure. If the key is not set, follow these steps from the beginning.

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:

    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, we recommend updating to the latest Amazon Windows AMI. 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, we recommend updating to the latest Amazon Windows AMI.

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

    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