I want to change the time zone set in my Amazon EC2 instance running Ubuntu Linux to local time?
My Question
How to change the time zone in
Information is available in aws documentation for changing the time zone in ec2 machine .Please find below the details :
Changing the Time Zone
Amazon Linux instances are set to the UTC (Coordinated Universal Time) time zone by default, but you may wish to change the time on an instance to the local time or to another time zone in your network.
To change the time zone on an instance
1.Identify the time zone to use on the instance. The /usr/share/zoneinfo directory contains a hierarchy of time zone data files. Browse the directory structure at that location to find a file for your time zone.
[ec2-user ~]$ ls /usr/share/zoneinfo
Africa Chile GB Indian Mideast posixrules US
America CST6CDT GB-Eire Iran MST PRC UTC
Antarctica Cuba GMT iso3166.tab MST7MDT PST8PDT WET
Arctic EET GMT0 Israel Navajo right W- SU
...
Some of the entries at this location are directories (such as America), and these directories contain time zone files for specific cities. Find your city (or a city in your time zone) to use for the instance. In this example, you can use the time zone file for Los Angeles, /usr/share/zoneinfo/America/Los_Angeles.
2.Update the /etc/sysconfig/clock file with the new time zone.
a.Open the /etc/sysconfig/clock file with your favorite text editor (such as vim or nano). You need to use sudo with your editor command because /etc/sysconfig/clock is owned by root.
b.Locate the ZONE entry, and change it to the time zone file (omitting the /usr/share/zoneinfo section of the path). For example, to change to the Los Angeles time zone, change the ZONE entry to the following.
ZONE="America/Los_Angeles"
c.Save the file and exit the text editor.
3.Create a symbolic link between /etc/localtime and your time zone file so that the instance finds the time zone file when it references local time information.
[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
from RHEL 7 admin guide
Seems this might be the command on REDHAT7
timedatectl set-timezone "Europe/Stockholm"
To get all available timezones type:
timedatectl list-timezone
for more informations use
man timedatectrl
it should be no different than your desktop Ubuntu process. See here
execute the following (to set timezone to Australia/Adelaide
)
$ echo "Australia/Adelaide" | sudo tee /etc/timezone
Australia/Adelaide
$ sudo dpkg-reconfigure --frontend noninteractive tzdata
Current default time zone: 'Australia/Adelaide'
Local time is now: Sat May 8 21:19:24 CST 2010.
Universal Time is now: Sat May 8 11:49:24 UTC 2010.
Update
You can use tzselect
utility to browse through. See here: http://manpages.ubuntu.com/manpages/precise/man1/tzselect.1.html
It's an interactive software. My Ubuntu (11.10) has it.
You could also refer this Wikipedia article
Brazil
Brazil/Acre
Brazil/DeNoronha
Brazil/East
Brazil/West
Well described in below link
https://askubuntu.com/questions/3375/how-to-change-time-zone-settings-from-the-command-line/594186#594186?s=8f7d09598b2246629a70bb1928501f52
e:g- sudo timedatectl set-timezone Asia/Kolkata
Check your current time zone by
$ date
To change it, run
$ sudo dpkg-reconfigure tzdata
This will show list of geographical areas. Select to narrow down available time zones. Next select city/timezone. And you have changed system to new timezone.
Locate your timezone in the directory /usr/share/zoneinfo/
.
E.g. To change timezone for Toronto /usr/share/zoneinfo/America/Toronto
Symlink your timezone to /etc/localtime
e.g. for Toronto:
sudo ln -sf /usr/share/zoneinfo/America/Toronto /etc/localtime
Reboot to finish
reboot