This post was published 10 years, 3 months ago. Due to the rapidly evolving world of technology, some concepts may no longer be applicable.
The time on the Amazon Linux AMI is set, by default to UTC. To change this, symlink one of the timezone files from /usr/share/zoneinfo/
to /etc/localtime
. The change takes effect immediately (and will also affect most logs, etc). For example:
ln -sf /usr/share/zoneinfo/EST5EDT /etc/localtime
To make the change persist through updates, it is necessary to set the ZONE
parameter in /etc/sysconfig/clock
as well. This parameter specifies the file under /usr/share/zoneinfo
that is to be used. For instance:
ZONE="EST5EDT"
I get this error:
/etc/localtime
is owned by root – you must, therefore, perform the operation as the superuser. Prefix the command withsudo
and it should work fine. i.e.:(Of course, if you aren’t in the
EST5EDT
timezone, change it to an appropriate entry from/usr/share/zoneinfo/
)Pingback: Set the time zone on Amazon Machine Image (AMI) | NathanFriend.co.uk