1

I have two EC2 instances operating in the Oregon location (us-west-2c). Each of these when I issue the command date returns a value 7 hours ahead of what I would expect.

I have tried adjusting the timezone settings and each one returns a date and time much different than I would expect.

Creating the file /etc/sysconfig/clock with a value of ZONE="America/Phoenix" did not provide any change. Even after restarting the instance. (i.e. sudo reboot)

Examples of what I am dealing with and seeing. (All results within 5 minutes of test time stamp.) Time of test : Sat Mar 26 13:24:16 MST 2016 (America/Phoenix)

sudo rm /etc/localtime && sudo ln -s /usr/share/zoneinfo/MST /etc/localtime && date

Sat Mar 26 18:23:35 MST 2016

sudo rm /etc/localtime && sudo ln -s /usr/share/zoneinfo/America/Phoenix /etc/localtime && date

Sat Mar 26 18:24:16 MST 2016

sudo rm /etc/localtime && sudo ln -s /usr/share/zoneinfo/GMT /etc/localtime && date

Sun Mar 27 01:22:21 GMT 2016

So if America/Phoenix is the same as GMT-7 then the above would be calculating correctly. But how is it that America/Phoenix is off by 7 hours?

What time(zone) is Amazon using for Servers in Oregon?

Thanks. Steven

EDIT NOTE: Time of test was noted above incorrectly. This has been updated. - Steven

5 Answers5

3

running the command

sudo dpkg-reconfigure tzdata 

and following the on screen wizard helped me.

0xF2
  • 187
1

In one of my tutorials I show how to set the timezone on Amazon Linux.

ls -l /usr/share/zoneinfo/        # (Find the applicable zone file)
mv /etc/localtime /etc/localtime.original
ln -s /usr/share/zoneinfo/*ZONEFILENAME* /etc/localtime
# EG I do this below
# ln -s /usr/share/zoneinfo/NZ /etc/localtime

Then edit /etc/sysconfig/clock

ZONE="NZ"
UTC=false
Tim
  • 33,870
  • 7
  • 56
  • 84
1

Commonly the system clock is set to UTC and the 'display' timezone is local time. The above configuration looks like it is specifying that the system clock is set to local time instead, which would account for your clock being off by the timezome offset.

Set UTC=true and set the timezone as you already have, you can look at http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html for AWS's definition of the process. Relog in and that should resolve the issue.

Additionally, time correctness is not a given on a AWS host so you should consider installing NTPd. Installing ntpd and running ntpdate will also fix your time issue even if you haven't reset the UTC configuration by forcing the time to the correct value.

Jason Martin
  • 5,193
0

Below 3 steps are sufficient to change the timezone on amazon Linux .

$ sudo vim /etc/sysconfig/clock ##(ZONE="IST" in my case its IST)
##(Do not change the UTC=true entry to another value. This entry is for the hardware clock)
$sudo ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime 
$sudo reboot

Ref document https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html

0

Thank you too all for trying to help me through this problem.

The issue, as I suspected from the beginning, had nothing to do with timezone declarations.

It was found that the NTP daemon was not started and subsequently the ports needed to authorized.

Again, thank you to each for your efforts.