Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Cloudwatch event - how to trigger for different timezones?

I've got a bunch of AWS Lambda functions that I want to trigger at certain times of day, but those times are in different timezones. For example, I might want events to trigger at:

  • 4:55pm Sydney time
  • 6:30pm Chicago time
  • 9pm Chicago time

...and so on.

Using Cloudwatch events, regardless of which AWS region I use, it seems that I can only specify events to trigger using UTC (i.e. London time). For today, that's fine; I can work out the time differences between London and Sydney, and London and Chicago, and so on - however, summer time comes into effect on different dates in different cities, and it'll cause my Lambdas to trigger at the wrong times when it does.

Is there a way to trigger these Cloudwatch events using non-UTC time settings? Alternately, is there a mechanism other than Cloudwatch that I can use to trigger Lambda functions at specific times of day, AND specify those times in the timezone I want?

Thanks in advance

like image 347
monch1962 Avatar asked Feb 07 '17 01:02

monch1962


People also ask

Is CloudWatch event region specific?

Rules in CloudWatch Events work only in the Region in which they are created. If you configure CloudTrail to track API calls in multiple Regions, and you want a rule based on CloudTrail to trigger in each of those Regions, you must create a separate rule in each Region that you want to track.

How do I change timezone in CloudWatch logs?

Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/ . In the navigation pane, choose Dashboards, and then choose a dashboard. In the upper-right corner of the dashboard screen, choose Custom. In the upper-right corner of the box that appears, select UTC or Local time from the dropdown.

Can CloudWatch aggregate data across regions?

Amazon CloudWatch can't aggregate data across Regions. Metrics are completely separate between Regions". But then it follows by an example which states, "For example, you can aggregate statistics for your EC2 instances that have detailed monitoring enabled. Instances that use basic monitoring aren't included.


1 Answers

Be careful - London is currently (as of 6 February, 2017) UTC but, starting on the 26th of March 2017, they will be in BST - British Summer Time which will be UTC + 1. In other words, London time is not necessarily UTC.

To me, the best bet is to have another lambda update the cloudwatch trigger time based on known timezone changes. You don't show your implementation language but, as an example, in Java you could take a look at this post. Run this Lambda once a day at UTC time zero and update the cloudwatch rule times appropriately.

like image 123
stdunbar Avatar answered Sep 22 '22 10:09

stdunbar