How to Change the Date and Time on Amazon’s EC2 Instance
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