EC2

Amazon Time Sync Service

 

 

Amazon Time Sync Service

Amazon provides the Amazon Time Sync Service, which you can access from your instance. This service uses a fleet of satellite-connected and atomic reference clocks in each AWS Region to deliver accurate current time readings of the Coordinated Universal Time (UTC) global standard through Network Time Protocol (NTP). The Amazon Time Sync Service automatically smooths any leap seconds that are added to UTC.

Whats new on this service so.?? Not much difference. Same NTP service. The advantage is to get accurate time for your EC2 instance you no need to run NTP server. No need internet connection especially.

The Amazon Time Sync Service is available through NTP at the 169.254.169.123 IP address for any instance running in a VPC. Your instance does not require access to the internet, and you do not have to configure your security group rules or your network ACL rules to allow access. Use the following procedures to configure the Amazon Time Sync Service on your instance using the chrony client.

On Amazon Linux, the default chrony configuration is already set up to use the Amazon Time Sync Service IP address. For Red Hat Enterprise Linux (RHEL), CentOS, Fedora, and Ubuntu distributions, you must edit the chrony configuration file to add a server entry for the Amazon Time Sync Service.

How to Configure

1.Connect to your instance and uninstall the NTP service.

sudo yum erase ntp*

2.Install the chrony package.

sudo yum install chrony

3.Edit the file /etc/chrony.conf

server 169.254.169.123 prefer iburst

If the line is present, then the Amazon Time Sync Service is already configured and you can go to the next step. If not, add the line after any other server or pool statements that are already present in the file, and save your changes.

4.Start the chrony daemon (chronyd)

sudo service chronyd start

Note:On RHEL and CentOS (up to version 6), the service name is chrony instead of chronyd.

5.Use the chkconfig command to configure chronyd to start at each system boot.

[ec2-user ~]$ sudo chkconfig chronyd on

Verify that chrony is using the 169.254.169.123 IP address to synchronize the time.

[ec2-user ~]$ chronyc sources -v

chronyc tracking

To configure in Ubuntu

sudo apt install chrony

Followe the same process. To restart the service use below command

sudo /etc/init.d/chrony restart

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.

Below procedure for Amazon Linux

Identify the time zone to use on the instance. The /usr/share/zoneinfo directory contains a hierarchy of time zone data files.

ls /usr/share/zoneinfo

Edit the zone entry in the file /etc/sysconfig/clock

ZONE=”America/Los_Angeles”

That’s all. No major difference when compare to NTP server. But you can get most accurate time for your EC2 instance easily at no additional cost.

Tagged

Leave a Reply

Your email address will not be published. Required fields are marked *