Reputation: 61
I have created a event bridge rule which is scheduled to trigger lambda with the following json input. but in the date value I want to pass the current date(sys date) dynamically everytime the schedule is triggered.
{"date": "2019-08-12"}
Upvotes: 6
Views: 7042
Reputation: 81
The datetime is included in the default payload under the attribute time
, however if you enter a custom payload it is not included because it only sends the data you enter.
It is possible to include the scheduled time in your custom payload using context attributes https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-schedule-context-attributes.html
{
"foo": "bar",
"time": "<aws.scheduler.scheduled-time>"
}
Upvotes: 3
Reputation: 52
To quote from https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-events.html:
The following fields appear in an event: ...
time
The event timestamp, which can be specified by the service originating the event. If the event spans a time interval, the service can report the start time, so this value might be before the time the event is received.
Upvotes: 0
Reputation: 852
If you leave the value as the default instead of setting it to constant you'll receive a JSON event which includes the date and time. You can see an example of the format in the Lambda developer guide.
Upvotes: 0