ECS | Manage instance configurations | Configure time

Alibaba Cloud NTP server



This topic describes Alibaba Cloud Network Time Protocol (NTP) servers. Alibaba Cloud provides internal and public NTP servers to synchronize the local time of Elastic Compute Service (ECS) instances in networks.

Internal and public NTP servers
NTP is used to synchronize computer time in a network.

The consistency of time and time zones in ECS is crucial because it can affect task execution results. For example, when you update a database or analyze logs, the time sequence significantly impacts the results. When you run business on ECS instances, you must standardize the time zones of all involved instances to prevent issues such as logical confusions and network request errors. You can use NTP servers to synchronize the local time of all your ECS instances in a network.

ECS provides high-precision NTP servers for your use. The ntp.cloud.aliyuncs.com server offers a distributed NTP service that uses Stratum 1 servers. Stratum 1 servers are suitable for industries such as finance, communication, scientific research, and astronomy that require precise timing. The NTP service is also used to synchronize the local time between ECS instances and other cloud services. The following table describes the domain names of Alibaba Cloud NTP servers in various networks. These domain names support only IPv4.

For more information, please check the official documentation.


Configure the NTP service for Windows instances



This topic describes how to enable and configure the NTP service for a Windows instance to ensure that the local system time is precisely synchronized.

Background information
By default, ECS instances in all Alibaba Cloud regions use UTC+8. You can configure or change time zones for your instances.

Windows Server 2012 R2 Datacenter Edition 64-bit is used in this topic to demonstrate how to use the NTP service to synchronize the local system time for Windows instances.

Enable the NTP service
By default, the Windows Time service is enabled on Windows Server operating systems. The NTP service must be enabled for Windows instances to synchronize the local system time. Perform the following operations to check and enable the NTP service:

Connect to the Windows ECS instance. For more information, see Overview.
Click the Start icon and open the Run dialog box. Run the services.msc command in the Run dialog box.
In the Services dialog box, find and double-click Windows Time.
In the Windows Time Properties (Local Computer) dialog box, perform the following operations:
Set Startup type to Automatic.
Make sure that the value of Service status is Running. Otherwise, click Start.
Click Apply and then click OK.
Modify the default NTP server address
By default, Windows Server operating systems use the Microsoft NTP server (time.windows.com), but errors may occur while the operating systems are synchronizing with the Microsoft NTP server. When you use a Windows instance, you can replace the default NTP server with an internal NTP server provided by Alibaba Cloud. Perform the following operations to modify the default NTP server address:

Connect to the Windows ECS instance. For more information, see Overview.
In the notification area of the taskbar, click the date and time, and then click Change date and time settings.
In the Date and Time dialog box, click the Internet Time tab and then click Change settings.
In the Internet Time Settings dialog box, select Synchronize with an Internet time server, enter the address of an Alibaba Cloud internal NTP server, and then click Update now. For more information, see Alibaba Cloud NTP server.

For more information, please check the official documentation.


Configure chrony for Linux instances (Alibaba Cloud Linux 2)



This topic describes how to modify the time zone of a Linux instance and how to enable, configure, and use chrony to ensure that the local system time of the instance is synchronized precisely with the standard time. An instance that runs an Alibaba Cloud Linux 2.1903 LTS 64-bit operating system is used in the examples.

Prerequisites
An inbound rule is added to a security group of the ECS instance to allow traffic on UDP port 123. For more information, see Add security group rules.

Background information
Alibaba Cloud Linux 2 uses chrony to synchronize local system time with the standard time. chrony consists of the following core programs:
chronyd is a daemon process that runs in the background. chronyd is used to adjust the system clock that runs in the kernel to synchronize with the clock server. chronyd calculates the offset of the system time relative to the standard time, and adjusts the system time accordingly.
chronyc provides a user interface to monitor the performance of chronyd and fine-tunes parameters in chronyd. chronyc can run on a server controlled by chronyd or a different remote server.
For more information, visit Chrony.

For more information, please check the official documentation.

Configure chrony for Linux instances (CentOS 7)



This topic describes how to change the time zone of an Elastic Compute Service (ECS) Linux instance and how to enable, configure, and use chrony to ensure that the local system time of the instance is synchronized with the UTC (Coordinated Universal Time) time. In this topic, an instance that runs a CentOS 7.8 operating system is used.

Prerequisites
An inbound rule is added to a security group of the ECS instance to allow traffic on UDP port 123. For more information, see Add a security group rule.

Background information
By default, ECS instances in all Alibaba Cloud regions use UTC+8. You can configure or change time zones for your instances.

CentOS 7 instances use chrony to synchronize the local system time with the UTC time. Compared with Network Time Protocol (NTP), chrony can synchronize the system clock more quickly and accurately on CentOS 6 instances and minimize time and frequency differences. chrony consists of the following core programs:
chronyd is a daemon process that runs in the background. chronyd is used to adjust the system clock that runs in the kernel to synchronize with the NTP clock server. chronyd can determine accurate statistics for the difference between the UTC time and the local system time and adjust the system time accordingly.
chronyc provides a user interface to monitor the performance of chronyd and to change various operating parameters in chronyd. chronyc can run on a server controlled by chronyd or a server not controlled by chronyd.


For more information, please check the official documentation.

Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00