First, remove the existing NTP service.
[ec2-user ~]$ sudo yum erase 'ntp*'
Install the chrony package for better time synchronization.
[ec2-user ~]$ sudo yum install chrony
Open the /etc/chrony.conf file and ensure it includes the following line for Amazon Time Sync Service:
server 169.254.169.123 prefer iburst minpoll 4 maxpoll 4
If this line is not present, add it after any existing server or pool statements.
Restart the chrony daemon to apply changes.
[ec2-user ~]$ sudo service chronyd restart
Note: On RHEL and CentOS (up to version 6), the service name is
chrony.
Configure chronyd to start at each system boot.
[ec2-user ~]$ sudo chkconfig chronyd on
Check that chrony is using the correct time source.
[ec2-user ~]$ chronyc sources -v
The output should show ^* next to the preferred time source.
Verify the time synchronization metrics reported by chrony.
[ec2-user ~]$ chronyc tracking
This command provides detailed information about time synchronization status.