How to Change the Date and Time on Amazon’s EC2 Instance

author

Aziro Marketing

Oct 24 - 0 min read

How to Change the Date and Time on Amazon’s EC2 Instance
play-pause-btn

Audio : Listen to This Blog.

Amazon Elastic Compute Cloud (EC2) provides scalable virtual private servers using Xen. The instances running on Xen sync their wall clock periodically with the underlying hypervisor. For changing the datetime settings, few extra configurations are required.

On a simple Linux Machine the date and time can be simply changed by stopping ntpd service and setting the date as:
# date -s “2 OCT 2006 18:00:00” But on Xen server based virtual instance it’s not this simple!

The above command will not throw any error but will neither change the date. In order to change the date on Xen server based instance first, you need to set the wall clock to run independently from Xen.

This can be done simply typing the command:
echo 1 > /proc/sys/xen/independent_wallclock

To keep the setting between reboots, just add the following to the end of the file – /etc/sysctl.conf :
xen.independent_wallclock = 1

If you want to re-sync the wall clock with Xen, simply type the command:
echo 0 > /proc/sys/xen/independent_wallclock

# date -s “2 OCT 2006 18:00:00”

But on Xen server based virtual instance it’s not this simple!

The above command will not throw any error but will neither change the date. In order to change the date on Xen server based instance first, you need to set the wall clock to run independently from Xen.

This can be done simply typing the command:
echo 1 > /proc/sys/xen/independent_wallclock
To keep the setting between reboots, just add the following to the end of the file – /etc/sysctl.conf :
xen.independent_wallclock = 1

If you want to re-sync the wall clock with Xen, simply type the command:
echo 0 > /proc/sys/xen/independent_wallclock

How to Change the Date and Time on Amazon’s EC2 InstanceHow to Change the Date and Time on Amazon’s EC2 InstanceHow to Change the Date and Time on Amazon’s EC2 Instance

LET'S ENGINEER

Your Next Product Breakthrough

Book a Free 30-minute Meeting with our technology experts.

Aziro has been a true engineering partner in our digital transformation journey. Their AI-native approach and deep technical expertise helped us modernize our infrastructure and accelerate product delivery without compromising quality. The collaboration has been seamless, efficient, and outcome-driven.

Customer Placeholder
CTO

Fortune 500 company