2

According to the wikipedia NTP article, NTP is accurate within 10ms over public internet.

I would like to maintain accuracy of logs/events across different AWS regions and my question is how accurately are the AWS clocks synced between the different regions?

Darthtrader
  • 311
  • 1
  • 6
  • 12
  • 1
    Are you talking about AWS's clocks on their internal systems? Or your own managed EC2 instances? If the former, you'll need to ask AWS. If the latter, well, dig into your own NTP metrics. – EEAA Sep 22 '17 at 14:13
  • @EEAA EC2 instances. How can you measure the deviation in time between two different AWS regions? The jitter would make it too inaccurate would it not? – Darthtrader Sep 22 '17 at 14:15
  • Is the worst-case tens-of-milliseconds not enough for you? – ceejayoz Sep 22 '17 at 14:22
  • @ceejayoz No, especially for file synchronization, where collisions are costly to fix. – Darthtrader Sep 22 '17 at 14:26
  • 1
    Remember that: The n.amazon.pool.ntp.org DNS records are intended to load balance NTP traffic from AWS. However, these are public NTP servers in the pool.ntp.org project, and they are not owned or managed by AWS.(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html) – Clayton Sep 22 '17 at 14:33
  • No, it says "NTP can usually maintain time to within _tens_ of milliseconds over the public Internet". So in the 10-90ms range. Quite different than "10ms". – Molomby Mar 03 '23 at 03:20

4 Answers4

3

Configure ntpd to point to the usual sources, but also peer with the ntpd you are running in other regions. Enable statistics. You now can record the offset of instances in different regions.

Do not expect sub 10 ms error or so between regions. The latency between regions, or to distant public NTP servers, makes that difficult.

Your requirements are probably not as extreme as one of the most distributed databases, Google Spanner. They developed a time service just for inter-datacenter databases, added hardware atomic clocks, and still I think ε was in the single digit ms.

John Mahowald
  • 32,050
  • 2
  • 19
  • 34
2

Update - this answer is out of date. See this blog post for more recent information.

AWS doesn't sync clocks across regions.

AWS doesn't run an NTP service / server, external NTP servers are used. NTP accounts for latency.

I imagine AWS runs fairly standard servers. Their internal clocks should be as accurate as any server.

So long as you have NTP configured to run, and you've allowed access to NTP servers in your security groups / NACLs, all regions should have accurate time. To actually test it would take some work.

Tim
  • 31,888
  • 7
  • 52
  • 78
1

AWS launched it's Time Sync Service shortly after these answers were supplied. The link below provides details on how you can sync, monitor and alert on time drift in AWS: https://aws.amazon.com/blogs/mt/manage-amazon-ec2-instance-clock-accuracy-using-amazon-time-sync-service-and-amazon-cloudwatch-part-1/

CamW
  • 151
  • 5
  • Doing statistics on the error to the local time service does not answer the question of time offsets *between* regions. One would hope a service advertised as "satellite-connected" uses the same sat nav references and so be well within the error of network latency. I have not seen NTP stats between AWS regions, however. – John Mahowald Aug 04 '21 at 13:45
1

Check out this link: Configuring Network Time Protocol (NTP) I would expect to see very accurate clocks in EC2, as the instance network interfaces are very stable for latency. That said, we're talking about NTP synced system clocks, which are notoriously inaccurate. I don't think you should safely rely on NTP and system clocks for anything timing sensitive.

You've responded that you're worried about "file synchronization, where collisions are costly to fix". Perhaps you should be looking into a synchronous solution like NFS/EFS.