My boss pointed out that the time stamp on the DB is out of sync. It was the development of an API that goes to write to the DB on EC2 in response to the request received by Lambda, but when I confirmed it, it was certainly 9 hours off ...
Why is the region set to Tokyo? I found this article when I searched variously. Set AWS lambda time zone to Tokyo | hacknote
The article seems to be before the release of the Tokyo region, but even if the region is set to Tokyo, for some reason only the time zone shifts ...
process.env.TZ = 'Asia/Tokyo'
It seems that I should insert this script, but unfortunately it was developed in Java, so I could not use it.
So what should I do? From the Lambda console, go down to Functions → a specific function, and at the bottom of the Code tab *** Key *** and *** in *** Environment variables *** It seems that you can enter ** TZ ** and ** Asia / Tokyo ** in Value *** respectively.
As a result of the test, it was output safely in Japan time. I was addicted to a simple place, so it also serves as a memorandum.
Recommended Posts