Search code examples
amazon-web-servicesamazon-ec2aws-lambdasynchronizationconsistency

Are AWS instances clocks synchronized with minute precision?


My question is: is time across AWS workers (e.g., EC2, Lambdas, ...) synchronized at a minute level (i.e., Unix Time across workers can differ at most 1 min between them)?

Why I need this: I am creating a system in AWS where a system periodically (not less than 1 every 5 minutes) schedules the following job to a worker from a pool:

  1. Get local Unix Time as jobTime.
  2. Read from Source data storage.
  3. Do transformation.
  4. Write to Target data storage if jobTime is later than what stored in Target data storage.

Pretty simple, uh? This approach guarantees Monotonic Reads (which is part of our requirements) on the Target data storage, at the condition that the Unix Time across workers is "sufficiently" synchronized/reliable (which is what I need to know).


Solution

  • A consistent and accurate time reference is crucial for many server tasks and processes. Most system logs include a time stamp that you can use to determine when problems occur and in what order the events take place. If you use the AWS CLI or an AWS SDK to make requests from your instance, these tools sign requests on your behalf. If your instance's date and time are not set correctly, the date in the signature may not match the date of the request, and AWS rejects the request.

    Amazon provides the Amazon Time Sync Service, which is accessible from all EC2 instances, and is also used by other AWS services. This service uses a fleet of satellite-connected and atomic reference clocks in each 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.

    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. The latest versions of Amazon Linux 2 and Amazon Linux AMIs synchronize with the Amazon Time Sync Service by default.

    Use the following procedures to configure the Amazon Time Sync Service on your instance using the chrony client. ...

    https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html

    Built on Amazon's proven network infrastructure, the service utilizes a fleet of redundant satellite-connected and atomic reference clocks in AWS regions to deliver current time readings of the Coordinated Universal Time (UTC) global standard. The service is designed to be highly available with a continuously monitored time infrastructure and provides a low variance reference time source.

    https://aws.amazon.com/about-aws/whats-new/2017/11/introducing-the-amazon-time-sync-service/