ECS Fargate Timezone

0

Hello,

I have tasks running on ecs fargate that I would like to modify the timezone from UTC to my actual timezone, how do I update this please, the docs do not specify how this can be done, will updating my environment variables of the task definition do the trick. The app is a dotnet application running on linux ecs fargate

Olive
已提問 2 個月前檢視次數 558 次
4 個答案
2
已接受的答案

Hello.

I think this can be changed by setting "TZ" in the environment variable in the ECS task definition.
For example, if you want to set Tokyo time, you can change it by specifying "TZ" as the key of the environment variable and setting "Asia/Tokyo" as the value.
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#container_definition_environment

By the way, please note that depending on the container image used in the task definition, it may not be possible to set the environment variable even if you use "TZ".
Check the base image documentation for how to change it.
https://wiki.alpinelinux.org/wiki/Setting_the_timezone

profile picture
專家
已回答 2 個月前
profile picture
專家
已審閱 2 個月前
profile pictureAWS
專家
已審閱 2 個月前
  • When configuring from the management console, you can configure from the task definition as shown in the image below. a

2

set env var "TZ" in the task definition

{
  "family": "your-task-family",
  "containerDefinitions": [
    {
      "name": "your-container-name",
      "image": "your-image",
      "cpu": 256,
      "memory": 512,
      "essential": true,
      "environment": [
        {
          "name": "TZ",
          "value": "America/New_York"
        }
      ],
      ...
    }
  ],
  ...
}

profile picture
專家
已回答 2 個月前
profile picture
專家
Artem
已審閱 1 個月前
1

Hi,

A fully detailled article on this topic: https://axelhodler.medium.com/setting-a-specific-timezone-in-aws-fargate-c328dfe4210c

You'll get the how-to and the rationale.

Best,

Didier

profile pictureAWS
專家
已回答 2 個月前
0

Thanks everyone, adding to env, worked fine as expected

Olive
已回答 2 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南