12
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Amazon ECSでCluster Instanceと同じタイムゾーンをTask Definitionに設定する

Last updated at Posted at 2016-04-12

のECS版です。

{
  "family": "test-volumes-from",
  "volumes": [
    {
      "name": "localtime",
      "host": {
        "sourcePath": "/etc/localtime"
      }
    }
  ],
  ...
  "containerDefinitions": [
    {
      ...
      "mountPoints": [
        {
          "sourceVolume": "localtime",
          "containerPath": "/etc/localtime",
          "readOnly": true
        }
      ],
      ...

Task Definitionの volumes でCluster Instance側のパスを指定し、 containerDefinitions 内の各コンテナーの設定の mountPoints でコンテナー側の /etc/localtime に読み取り専用でマウントします。以上。

おまけ

素のAmazon LinuxをUTC+9にしてecs-agentを入れるUserData

#!/bin/bash

unalias cp

cp -f -p /usr/share/zoneinfo/Japan /etc/localtime

cat << _EOT_ > /etc/sysconfig/clock
ZONE="Asia/Tokyo"
UTC=false
_EOT_

yum install -y ecs-init
echo ECS_CLUSTER=test >> /etc/ecs/ecs.config
sudo service docker start
sudo start ecs

base64 encoded

IyEvYmluL2Jhc2gKdW5hbGlhcyBjcApjcCAtZiAtcCAvdXNyL3NoYXJlL3pvbmVpbmZvL0phcGFuIC9ldGMvbG9jYWx0aW1lCmNhdCA8PCBfRU9UXyA+IC9ldGMvc3lzY29uZmlnL2Nsb2NrClpPTkU9IkFzaWEvVG9reW8iClVUQz1mYWxzZQpfRU9UXwp5dW0gaW5zdGFsbCAteSBlY3MtaW5pdAplY2hvIEVDU19DTFVTVEVSPWJhY2tsb2dfYWRtaW4gPj4gL2V0Yy9lY3MvZWNzLmNvbmZpZwpzdWRvIHNlcnZpY2UgZG9ja2VyIHN0YXJ0CnN1ZG8gc3RhcnQgZWNzCg==

参考

12
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?