Like the title says, I am having trouble setting up container overrides from eventbridge to AWS BATCH.
For context, I use AWS Batch to hold container configurations for an ecs container.
The Eventbridge rule I have set has no problem starting the batch job, it just doesn't pass the container override parameter that I have set using a input transformer
I have a trigger setup in Eventbridge from s3 that detects any file uploads in a folder like so:
Event pattern
{
"detail": {
"bucket": {
"name": ["meter-alarms-ls1-ls2-download-test-app-bucket"]
},
"object": {
"key": [{
"prefix": "input/"
}]
}
},
"detail-type": ["Object Created"],
"source": ["aws.s3"]
}
Then I set the target to my Batch Configurations (Job and Queue).
However I have a little input transformer to target setup like this
Input path
{
"object_key": "$.detail.object.key"
}
Input template
{
"containerOverrides": {
"environment": [
{
"name": "FILE_NAME",
"value": "<object_key>"
}
]
}
}
I have tested permissions, and tested if batch can even handle overrides using this command
aws batch submit-job
--job-name "TestJob"
--job-queue "queueName"
--job-definition "jobDef"
--container-overrides '{
"environment": [
{
"name": "FILE_NAME",
"value": "example-file-name"
}
]
}'
And the batch job works fine.
As I typed this out and looked at the documentation the answer is actually very stupid.
{
"ContainerOverrides": {
"Environment": [
{
"Name": "FILE_NAME",
"Value": "<object_key>"
}
]
}
}
It simply just required Capitalisation of each word