We do support Round the Clock 24 x 7 x 365 (+91) 883 012 3924
 

Change time zone on Amazon Linux AMI [AWS]

Change time zone on Amazon Linux AMI [AWS]

First, we need to  configure AWS instance to use the Amazon Time Sync Service :

 

  1. Connect to your instance and uninstall the NTP service.
    [ec2-user ~]$ sudo yum erase 'ntp*'
  2. Install the chrony package.
    [ec2-user ~]$ sudo yum install chrony
  3. Open the /etc/chrony.conf file. Verify that the file includes the following line:
    server 169.254.169.123 prefer iburst
  4. Start the chrony daemon (chronyd).
    [ec2-user ~]$ sudo service chronyd start

    Note :
    On RHEL and CentOS (up to version 6), the service name is chrony instead of chronyd.

  5. Use the chkconfig command to configure chronyd to start at each system boot.
    [ec2-user ~]$ sudo chkconfig chronyd on

Now we need to change the time zone on an instance :

  1.  Open /etc/sysconfig/clock file.

2. Locate the ZONE entry and set new time zone.

You will find a list of all time zone into /usr/share/zoneinfo/ folder

For example, to change to the Los Angeles time zone, change the ZONE entry to the following:

ZONE="America/Los_Angeles"

Note : Please do not change the UTC=true entry to another value. This entry is for the hardware clock

3.  Create a symbolic link between /etc/localtime and your time zone file

[ec2-user ~]$ sudo ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

4. Reboot the system to pick up the new time zone information in all services and applications.

[ec2-user ~]$ sudo reboot

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Post navigation

Previous Post :