How to Set Up NTP on Ubuntu in AWS

  1. Configure NTP in timesyncd.conf

echo "NTP=169.254.169.123" | sudo tee -a /etc/systemd/timesyncd.conf
cat /etc/systemd/timesyncd.conf
  1. Enable the timesyncd.service
sudo systemctl unmask systemd-timesyncd.service
sudo apt install systemd-timesyncd -y
  1. Enable the timesyncd.service at boot & Restart
sudo systemctl enable systemd-timesyncd.service
sudo  systemctl restart systemd-timesyncd
  1. Set the system time to be synchronized with NTP
sudo  timedatectl set-ntp true