You have a few options here.
It seems you are using EventBridge Scheduled Rules. With these, you can use an InputTransformer on your Target and the predefined variable for <aws.events.event.ingestion-time>
.
You could also move to the recently released EventBridge Scheduler, where you can use the <aws.scheduler.scheduled-time>
context attribute.
And lastly, you could do this inside your Step Functions workflow, using the Context Object as in the example below.
{
"StartAt": "Add Execution Context",
"States": {
"Add Execution Context": {
"Type": "Pass",
"End": true,
"ResultPath": "$.execution_context",
"Parameters": {
"execution_date.$": "States.ArrayGetItem(States.StringSplit($$.Execution.StartTime,'T'), 0)"
}
}
}
}
This will augment your input payload with that data. So if you passed this into the state machine defined above:
{
"id": "25"
}
You'd get:
{
"id": "25",
"execution_context": {
"execution_date": "2023-06-08"
}
}