Last active
August 29, 2015 14:11
-
-
Save na0AaooQ/6a463a4f080f84111ce2 to your computer and use it in GitHub Desktop.
AWS EC2インスタンス作成時 User DataによりタイムゾーンをJSTに変更する ref: http://qiita.com/na0AaooQ/items/52dea5f982745592a663
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ date | |
Tue Dec 23 01:30:39 UTC 2014 | |
$ cat /etc/sysconfig/clock | |
ZONE="UTC" | |
UTC=true | |
$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "User Data start" | |
yum -y update | |
unalias cp | |
cp -f -p /usr/share/zoneinfo/Japan /etc/localtime | |
cat << _EOT_ > /etc/sysconfig/clock | |
ZONE="Asia/Tokyo" | |
UTC=false | |
_EOT_ | |
chmod 644 /etc/sysconfig/clock | |
/etc/init.d/crond restart | |
echo "User Data end" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ date | |
Tue Dec 23 11:19:45 JST 2014 | |
$ cat /etc/sysconfig/clock | |
ZONE="Asia/Tokyo" | |
UTC=false | |
$ | |
$ sudo yum update | |
Loaded plugins: priorities, update-motd, upgrade-helper | |
amzn-main/latest | 2.1 kB 00:00 | |
amzn-updates/latest | 2.3 kB 00:00 | |
No packages marked for update | |
$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat /var/log/cloud-init-output.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat /var/lib/cloud/instance/user-data.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment