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 Amazon EC2?
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 Amazon EC2?
UPDATED ANSWER FOR UBUNTU 16.04:
Do:
sudo timedatectl set-timezone America/New_York
to update your timezone.
To list down all the available timezones you can do:
timedatectl list-timezones
For Red Hat or CentOS:
Check the time:
timedatectl status
List all available timezones:
timedatectl list-timezones
Set up your timezone:
sudo timedatectl set-timezone Europe/Paris
Well described in below link
e:g- sudo timedatectl set-timezone Asia/Kolkata
When you create a new EC2 instance and select "Amazon Linux 2 AMI (HVM)" as Amazon Machine Image (AMI), you can insert these lines in the "User Data" section. Based on which region you are in, change the second line with the timezone that works for you. I am in Central European Time (CET). Bear in mind that this bootstrap code is executed as root and only once when the instance is created.
#!/bin/bash
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/CET /etc/localtime
If you want to see all the other timezones available, ssh to one instance and run:
ls /usr/share/zoneinfo