AWS EC2調整Timezone/時間 (NTP/Chrony)

因為突然Cloudwatch自訂Metrics不作用了
噴了這個錯

1
Error deploying new application: Unhandled error during deployment: Deployment Failed: Signature not yet current: 20181206T111447Z is still later than 20181206T111151Z (20181206T110651Z + 5 min.)Discovered an Error, Any Fix?- Signature not yet current: 20181206T111447Z

然後估狗發現應該是時間差問題就順手修了一下

Discovered an Error, Any Fix?- Signature not yet current

NTP更新

1
sudo ntpdate -u 169.254.169.123

169.254.169.123是AWS自家的NTP Server

官方推薦chrony

直接弄成sh檔比較方便…

1
2
3
4
5
6
7
8
9
10
#!/bin/bash
sudo cp /etc/localtime /root/old.timezone
sudo rm -r /etc/localtime
sudo ln -s /usr/share/zoneinfo/Asia/Taipei /etc/localtime
sudo yum erase ntp* -y
sudo yum install chrony -y
sudo service chronyd start
sudo chkconfig chronyd on
chronyc sources -v
chronyc tracking

Reference

利用 Amazon Time Sync Service 保持时间同步

为 Linux 实例设置时间

CentOS 修改server 時區

Linux (Redhat / Fedora / CentOS) 設定時間的方式