AWS Tips and Tricks: Time Zone

by | May 31, 2016

AWS
I have mentioned in previous posts I am no way near an expert in OS’ especially Linux, although I have to use in some form or another on a regular basis. While attempting to configure one of our AWS Linux servers I needed to do a few things that I have not had to do in the past and didn’t know how to do. I thought I would share some of those learnings.

Setting the timezone on AWS Linux EC2

I was setting up a server that users would be using to schedule some tasks so it needed to be in our local time zone to make it easier to schedule. AWS documentation is pretty detailed and I found this page, Setting the Time for Your Linux Instance.
Essentially you need to:

  1. Determine what time zone you want. The hierarchy of time zone files can be found in the /usr/share/zoneinfo.

I needed the “NZ”.

  1. Update the /etc/sysconfig/clock file. Because I was configuring this during start-up I used the following command in the User Data field of the instance (if you are doing it manually you’ll need to do with sudo as the clock file is owned by root).

sed -i.bak ‘s/ZONE=”UTC”/ZONE=”NZ”/’ /etc/sysconfig/clock

  1. Create a symbolic link between /etc/localtime and your selected time zone file. The command I used is below (again you may need to use sudo).

ln -sf /usr/share/zoneinfo/NZ /etc/localtime

  1. Reboot instance to ensure all services reference new time zone.

 
Time zone set. That’s it.
Barry, Preventer of Chaos
Barry blogs about how to keep things in your system running.
You can read all of Barry’s blogs here.
We’ve got the best SAS Administrators in New Zealand ready to help you with your SAS environment. Find out more here.
 

0 Comments

Trackbacks/Pingbacks

  1. AWS TIPS AND TRICKS: Automatically create a cron job at Instance creation | OptimalBI - […] mentioned in my previous blog AWS TIPS AND TRICKS: TIME ZONE I have had to do a few things I didn’t…
  2. How to – Zero to AWS Certified | OptimalBI - […] AWS TIPS AND TRICKS: TIME ZONE […]
Submit a Comment

Your email address will not be published. Required fields are marked *