10

I have an Amazon EC2 dedicated instance (Fedora Linux). Although I took an instance in US West, it came set to EST.
I changed the timezone to PST (export TZ=America/Los_Angeles) and it works - for several hours. Then it resets itself to EST.

What am I doing wrong and how can I set it to PST permanently?

Brian Webster
  • 1,123
  • 1
  • 18
  • 39

3 Answers3

16

I don't run Fedora for my EC2 instances as I need something stable for more than 6 months, so I use CentOS... But it should be the same... Just run the following:

ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

That should change your systems default timezone to PST and should only be affected when the instance is brought up from scratch.

Jeremy Bouse
  • 11,341
  • 2
  • 28
  • 40
2

Change the ZONE setting in /etc/sysconfig/clock

Philip Reynolds
  • 9,799
  • 1
  • 34
  • 33
0

Have the config for setting timezone in your .bashrc .

In case you are looking for using the TZ in your application from the system, its a bad idea since EC2 instances that go down/crash can be a different system when they come back up.

Sairam
  • 209
  • 1
  • 8