Question:
I have a single instance server deployed on AWS – Elastic Beanstalk that needs timezone configuration, and I changed the timezone as logging into the EC2 environment with ssh, and update it with the linux commands listed below;
1 2 3 4 |
sudo rm /etc/localtime sudo ln -sf /usr/share/zoneinfo/Europe/Istanbul /etc/localtime sudo reboot |
Everything is fine as the server is running as a single instance. The problem arose as I wanted to use Auto Scaling, Load Balancing feature. On single instance, updating the timezone on linux AMI is fine, but on auto scaling mode, because that the instances are created/destroyed/recreated according to the threshold metrics, all the configuration is lost.
My simple question is, how can I change/configure the timezone for an auto scalable, load balancing mode in AWS Elastic Beanstalk ?
Answer:
you can configure the newly starting server with ebextensions.
Here’s an example that works for me. Add the following command into the file .ebextensions/timezone.config
:
1 2 3 4 |
commands: set_time_zone: command: ln -f -s /usr/share/zoneinfo/US/Pacific /etc/localtime |